Fixed min-date validation in date-picker
authorMarcel Werk <burntime@woltlab.com>
Mon, 12 Dec 2016 16:52:55 +0000 (17:52 +0100)
committerMarcel Werk <burntime@woltlab.com>
Mon, 12 Dec 2016 16:53:00 +0000 (17:53 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Date/Picker.js

index 3143b0714301b5b19fc33149a20c8a724ea78a6e..24ded4cb1b8216616aa5a3b567a9e9b165a54316 100644 (file)
@@ -388,6 +388,7 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment
                                elShow(_dateCells[35].parentNode);
                                
                                var selectable;
+                               var comparableMinDate = new Date(_minDate.getFullYear(), _minDate.getMonth(), _minDate.getDate());
                                for (i = 0; i < 42; i++) {
                                        if (i === 35 && date.getMonth() !== month) {
                                                // skip the last row if it only contains the next month
@@ -401,7 +402,7 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment
                                        cell.textContent = date.getDate();
                                        selectable = (date.getMonth() === month);
                                        if (selectable) {
-                                               if (date < _minDate) selectable = false;
+                                               if (date < comparableMinDate) selectable = false;
                                                else if (date > _maxDate) selectable = false;
                                        }