Skip to content
This repository has been archived by the owner on Dec 24, 2019. It is now read-only.

Commit

Permalink
The Date object constructor does not take any arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
okonomiyaki3000 committed Feb 17, 2014
1 parent df28d16 commit b36472e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ var DatePicker = new Class({

// determine starting value(s)
if ($chk(item.get('value'))) {
var init_clone_val = this.format(new Date(this.unformat(item.get('value'), this.options.inputOutputFormat)), this.options.format);
var init_clone_val = this.format(this.unformat(item.get('value'), this.options.inputOutputFormat), this.options.format);
} else if (!this.options.allowEmpty) {
var init_clone_val = this.format(new Date(), this.options.format);
} else {
Expand Down Expand Up @@ -182,10 +182,10 @@ var DatePicker = new Class({
} else {
init_visual_date = new Date();
if ($chk(this.options.maxDate) && init_visual_date.valueOf() > this.options.maxDate.valueOf()) {
init_visual_date = new Date(this.options.maxDate.valueOf());
init_visual_date.setTime(this.options.maxDate.getTime());
}
if ($chk(this.options.minDate) && init_visual_date.valueOf() < this.options.minDate.valueOf()) {
init_visual_date = new Date(this.options.minDate.valueOf());
init_visual_date.setTime(this.options.minDate.getTime());
}
}

Expand Down Expand Up @@ -227,7 +227,8 @@ var DatePicker = new Class({
show: function(position, timestamp) {
this.formatMinMaxDates();
if ($chk(timestamp)) {
this.d = new Date(timestamp);
this.d = new Date();
this.d.setTime(timestamp);
} else {
this.d = new Date();
}
Expand All @@ -250,7 +251,8 @@ var DatePicker = new Class({
}

// remember current working date
var startDate = new Date(this.d.getTime());
var startDate = new Date();
startDate.setTime(this.d.getTime());

// intially assume both left and right are allowed
this.limit = { right: false, left: false };
Expand Down Expand Up @@ -710,7 +712,7 @@ var DatePicker = new Class({
case 'h': if (a['a'] == 'pm' || a['A'] == 'PM') { d.setHours(v == 12 ? 0 : v.toInt() + 12); } else { d.setHours(v); } break;
case 'i': d.setMinutes(v); break;
case 's': d.setSeconds(v); break;
case 'U': d = new Date(v.toInt() * 1000);
case 'U': d = new Date(); d.setTime(v.toInt() * 1000);
}
};

Expand Down

0 comments on commit b36472e

Please sign in to comment.