From 2ea9dab54220beff141ddfe5c6a42cf1f7f8d2ad Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 15 Jul 2016 15:49:28 +0200 Subject: [PATCH] Added support for min/max date range --- wcfsetup/install/files/js/WoltLab/WCF/Date/Picker.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Date/Picker.js b/wcfsetup/install/files/js/WoltLab/WCF/Date/Picker.js index 928f4b118a..772d942aca 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Date/Picker.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Date/Picker.js @@ -77,6 +77,10 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment elData(element, 'min-date', '100'); elData(element, 'max-date', 'now'); } + else { + if (element.min) elData(element, 'min-date', element.min); + if (element.max) elData(element, 'max-date', element.max); + } this._initDateRange(element, now, true); this._initDateRange(element, now, false); @@ -199,6 +203,9 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment throw new Error("Reference date picker identified by '" + value + "' does not exists (element id: '" + element.id + "')."); } } + else if (/^\d{4}\-\d{2}\-\d{2}T/.test(value)) { + value = new Date(value).getTime(); + } else { value = new Date((isMinDate ? 1970 : 2038), 0, 1).getTime(); } -- 2.20.1