mirror of https://github.com/zulip/zulip.git
timerender: Fix get_timestamp_for_flatpickr when no parameter passed.
Previously, when no parameter was passed to the get_timestamp_for_ flatpickr method, it would result in an uncaught exception. This is breaking the "Add global time" of compose bar. This can be avoided by doing an early return of current time to hour in case no string is passed.
This commit is contained in:
parent
d971b36026
commit
49e3e6da06
|
@ -429,8 +429,15 @@ function get_current_time_to_hour(): Date {
|
|||
return timestamp;
|
||||
}
|
||||
|
||||
export function get_timestamp_for_flatpickr(timestring: string): Date {
|
||||
export function get_timestamp_for_flatpickr(timestring?: string): Date {
|
||||
let timestamp;
|
||||
|
||||
// timestring is undefined when first opening the picker from the
|
||||
// compose box button.
|
||||
if (timestring === undefined) {
|
||||
return get_current_time_to_hour();
|
||||
}
|
||||
|
||||
try {
|
||||
// If there's already a valid time in the compose box,
|
||||
// we use it to initialize the flatpickr instance.
|
||||
|
|
Loading…
Reference in New Issue