Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix JS errors when creating new assignment
  • Loading branch information
hansonywu authored and jerboaa committed Mar 13, 2012
1 parent 1308af6 commit 624ac11
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions public/javascripts/PeriodDeltaChain/PeriodDeltaChain.js
Expand Up @@ -13,7 +13,7 @@ var PeriodDeltaChain = Class.create({
this.hour = 3600000; // 1 hour is 3600000 milliseconds
this.period_root_id = params.period_root_id;
this.date_format = this.set_or_default(params.date_format, "");
this.due_date = this.set_or_default(new Date(Date.parseFormattedString(params.due_date)), new Date());
this.set_due_date(params.due_date);
this.period_class = this.set_or_default(params.period_class, 'period');
},
refresh: function() {
Expand All @@ -36,12 +36,13 @@ var PeriodDeltaChain = Class.create({
},
set_due_date: function(new_due_date) {
delete this.due_date;
this.due_date = new Date(Date.parseFormattedString(new_due_date));
this.due_date = (typeof new_due_date == 'undefined' ?
new Date(Date.parseFormattedString(new_due_date)) : new Date());
},
set_or_default: function(value, default_value) {
if (typeof value == 'undefined') {
return default_value;
}
}
return value;
}
});

0 comments on commit 624ac11

Please sign in to comment.