mirror of https://github.com/zulip/zulip.git
profile-fields: Check for date fields before initializing flatpickr.
This commit is contained in:
parent
5e42c8cd2b
commit
1350157fdf
|
@ -151,7 +151,12 @@ export function initialize_custom_user_type_fields(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initialize_custom_date_type_fields(element_id: string): void {
|
export function initialize_custom_date_type_fields(element_id: string): void {
|
||||||
flatpickr($(element_id).find(".custom_user_field .datepicker")[0]!, {
|
const $date_picker_elements = $(element_id).find(".custom_user_field .datepicker");
|
||||||
|
if ($date_picker_elements.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
flatpickr($date_picker_elements, {
|
||||||
altInput: true,
|
altInput: true,
|
||||||
altFormat: "F j, Y",
|
altFormat: "F j, Y",
|
||||||
allowInput: true,
|
allowInput: true,
|
||||||
|
|
Loading…
Reference in New Issue