mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user