[Dojo-checkins] r1380 - trunk/src/widget
dojo-checkins at dojotoolkit.org
dojo-checkins at dojotoolkit.org
Sun Sep 4 01:52:23 PDT 2005
Author: dylan
Date: Sun Sep 4 01:52:22 2005
New Revision: 1380
Modified:
trunk/src/widget/HtmlDatePicker.js
Log:
fixes for the DatePicker picker widget, and add toRfcDate implementation
Modified: trunk/src/widget/HtmlDatePicker.js
==============================================================================
--- trunk/src/widget/HtmlDatePicker.js (original)
+++ trunk/src/widget/HtmlDatePicker.js Sun Sep 4 01:52:22 2005
@@ -50,7 +50,7 @@
this.initData = function() {
this.today = new Date();
if(this.storedDate) {
- this.date = fromRfcDate();
+ this.date = this.fromRfcDate(this.storedDate);
} else {
this.date = this.today;
}
@@ -61,14 +61,26 @@
this.initFirstSaturday(this.date.getMonth().toString(), this.date.getFullYear());
}
- this.setDate = function() {
- this.today = new Date();
- return this.toRfcDate(this.today);
+ this.setDate = function(rfcDate) {
+ this.storedDate = rfcDate;
}
this.toRfcDate =function(jsDate) {
- dj_unimplemented("dojo.widget.HtmlDatePicker.toRfcDate");
- //return rfcDate;
+ if(!jsDate) {
+ jsDate = this.today;
+ }
+ var year = jsDate.getFullYear();
+ var month = jsDate.getMonth() + 1;
+ if (month < 10) {
+ month = "0" + month.toString();
+ }
+ var date = jsDate.getDate();
+ if (date < 10) {
+ date = "0" + date.toString();
+ }
+ // because this is a date picker and not a time picker, we treat time
+ // as zero
+ return year + "-" + month + "-" + date + "T00:00:00+00:00";
}
this.fromRfcDate = function(rfcDate) {
@@ -91,6 +103,8 @@
}
this.initUI = function() {
+ this.selectedIsUsed = false;
+ this.currentIsUsed = false;
var currentClassName = "";
var previousDate = new Date();
var calendarNodes = this.calendarDatesContainerNode.getElementsByTagName("td");
@@ -252,7 +266,7 @@
}
if((!this.currentIsUsed) && (date.getDate() == this.today.getDate()) && (date.getMonth() == this.today.getMonth()) && (date.getFullYear() == this.today.getFullYear())) {
currentClassName = currentClassName + " " + this.classNames.currentDate;
- this.todayIsUsed = 1;
+ this.currentIsUsed = 1;
}
return currentClassName;
}
@@ -277,9 +291,9 @@
year = (month==11) ? --year : year;
}
this.date = new Date(year, month, evt.target.innerHTML);
+ this.setDate(this.toRfcDate(this.date));
this.initUI();
}
-
}
dj_inherits(dojo.widget.HtmlDatePicker, dojo.widget.HtmlWidget);
More information about the Dojo-checkins
mailing list