[open-ils-commits] r17406 - branches/rel_2_0/Open-ILS/web/js/ui/default/booking (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Aug 31 13:06:30 EDT 2010


Author: senator
Date: 2010-08-31 13:06:27 -0400 (Tue, 31 Aug 2010)
New Revision: 17406

Modified:
   branches/rel_2_0/Open-ILS/web/js/ui/default/booking/reservation.js
Log:
Backport r17405: fix start/end date selection problem with reservations


Modified: branches/rel_2_0/Open-ILS/web/js/ui/default/booking/reservation.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/ui/default/booking/reservation.js	2010-08-31 17:05:20 UTC (rev 17405)
+++ branches/rel_2_0/Open-ILS/web/js/ui/default/booking/reservation.js	2010-08-31 17:06:27 UTC (rev 17406)
@@ -8,6 +8,7 @@
 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 @@
     };
 }
 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 @@
         [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.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());



More information about the open-ils-commits mailing list