Page MenuHomePhabricator

D15727.id37899.diff
No OneTemporary

D15727.id37899.diff

diff --git a/webroot/rsrc/js/core/behavior-fancy-datepicker.js b/webroot/rsrc/js/core/behavior-fancy-datepicker.js
--- a/webroot/rsrc/js/core/behavior-fancy-datepicker.js
+++ b/webroot/rsrc/js/core/behavior-fancy-datepicker.js
@@ -264,6 +264,7 @@
function getValidDate() {
var written_date = new Date(value_y, value_m-1, value_d);
+
if (isNaN(written_date.getTime())) {
return new Date();
} else {
@@ -272,6 +273,14 @@
value_y += 2000;
written_date = new Date(value_y, value_m-1, value_d);
}
+
+ // adjust for a date like February 31
+ var adjust = 1;
+ while (written_date.getMonth() !== value_m-1) {
+ written_date = new Date(value_y, value_m-1, value_d-adjust);
+ adjust++;
+ }
+
return written_date;
}
}

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 27, 8:56 AM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6750932
Default Alt Text
D15727.id37899.diff (810 B)

Event Timeline