Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

timerender: Fix get_timestamp_for_flatpickr when no parameter passed.

roanster00749e3e6da062c
diff --git a/web/src/timerender.ts b/web/src/timerender.ts
index 037be40a605..cf69deefd09 100644
--- a/web/src/timerender.ts
+++ b/web/src/timerender.ts
@@ -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.