From: senator Date: Tue, 31 Aug 2010 17:05:20 +0000 (+0000) Subject: Booking: fix a bug in selecting the start/end date of a reservation X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=57f95be4f4f399c64a19dbe19d57f9c345ac166b;p=evergreen%2Fbjwebb.git Booking: fix a bug in selecting the start/end date of a reservation This bug would generally only manifest on certain days of the year (1/29-31, 3/31, 5/31, 8/31, and 10/31). git-svn-id: svn://svn.open-ils.org/ILS/trunk@17405 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/ui/default/booking/reservation.js b/Open-ILS/web/js/ui/default/booking/reservation.js index 7c2e242d6..01ccb359d 100644 --- a/Open-ILS/web/js/ui/default/booking/reservation.js +++ b/Open-ILS/web/js/ui/default/booking/reservation.js @@ -8,6 +8,7 @@ dojo.require("openils.widget.OrgUnitFilteringSelect"); dojo.require("dojo.data.ItemFileReadStore"); dojo.require("dijit.form.DateTextBox"); dojo.require("dijit.form.TimeTextBox"); +dojo.require("dojo.date.stamp"); dojo.requireLocalization("openils.booking", "reservation"); /* @@ -60,7 +61,7 @@ function TimestampRange() { }; } TimestampRange.prototype.get_timestamp = function(when) { - return this.any_widget.serialize(this[when]). + return dojo.date.stamp.toISOString(this[when]). replace("T", " ").substr(0, 19); }; TimestampRange.prototype.get_range = function() { @@ -69,16 +70,14 @@ TimestampRange.prototype.get_range = function() { [this.get_timestamp("start"), this.get_timestamp("end")]; }; TimestampRange.prototype.update_from_widget = function(widget) { - var when = widget.id.match(/(start|end)/)[1]; - var which = widget.id.match(/(date|time)/)[1]; + var when = widget.name.match(/(start|end)/)[1]; + var which = widget.name.match(/(date|time)/)[1]; - if (this.any_widget == undefined) - this.any_widget = widget; if (this.nodes[when][which] == undefined) this.nodes[when][which] = widget.domNode; /* We'll need this later */ if (when && which) { - this.update_timestamp(when, which, widget.value); + this.update_timestamp(when, which, widget.attr("value")); } this.compute_validity(); @@ -116,8 +115,8 @@ TimestampRange.prototype.current_minimum = function() { TimestampRange.prototype.update_timestamp = function(when, which, value) { if (which == "date") { this[when].setFullYear(value.getFullYear()); - this[when].setMonth(value.getMonth()); - this[when].setDate(value.getDate()); + /* month and date MUST be done together */ + this[when].setMonth(value.getMonth(), value.getDate()); } else { /* "time" */ this[when].setHours(value.getHours()); this[when].setMinutes(value.getMinutes());