Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/core/behavior-fancy-datepicker.js
Show First 20 Lines • Show All 418 Lines • ▼ Show 20 Lines | function(e) { | ||||
value_m = value_m + parseInt(p[1], 10); | value_m = value_m + parseInt(p[1], 10); | ||||
if (value_m > 12) { | if (value_m > 12) { | ||||
value_m -= 12; | value_m -= 12; | ||||
value_y++; | value_y++; | ||||
} else if (value_m <= 0) { | } else if (value_m <= 0) { | ||||
value_m += 12; | value_m += 12; | ||||
value_y--; | value_y--; | ||||
} | } | ||||
// This relies on months greater than 11 rolling over into the next | |||||
// year and days less than 1 rolling back into the previous month. | |||||
var last_date = new Date(value_y, value_m, 0); | |||||
if (value_d > last_date.getDate()) { | |||||
// The date falls outside the new month, so stuff it back in. | |||||
value_d = last_date.getDate(); | |||||
} | |||||
break; | break; | ||||
case 'd': | case 'd': | ||||
// User clicked a day. | // User clicked a day. | ||||
value_d = parseInt(p[1], 10); | value_d = parseInt(p[1], 10); | ||||
write_date(); | write_date(); | ||||
// Wait a moment to close the selector so they can see the effect | // Wait a moment to close the selector so they can see the effect | ||||
// of their action. | // of their action. | ||||
Show All 21 Lines |