Skip to content

Commit

Permalink
Fixed conversion of incoming dates. Fixed end date out conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
ansiblegalaxy committed Apr 3, 2014
1 parent 76f0fd6 commit 5f41311
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-scheduler",
"version": "0.0.10",
"version": "0.0.11",
"authors": [
"Chris Houseknecht <[email protected]>"
],
Expand Down
16 changes: 9 additions & 7 deletions lib/angular-scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ angular.module('AngularScheduler', ['underscore'])
options.occurrenceCount = this.scope.schedulerOccurrenceCount;
}
if (this.scope.schedulerEnd.value === 'on') {
options.endDate = scope.schedulerEndDt + this.scope.schedulerUTCTime.replace(/^\d{4}-\d{2}-\d{2}/,'');
options.endDate = scope.schedulerEndDt.replace(/(\d{2})\/(\d{2})\/(\d{4})/, function(match, p1, p2, p3) {
return p3 + '-' + p1 + '-' + p2;
}) + 'T' + this.scope.schedulerUTCTime.replace(/\d{2}\/\d{2}\/\d{4} /,'').replace(/ UTC/,'') + 'Z';
}
if (this.scope.schedulerFrequency.value === 'weekly') {
options.weekDays = this.scope.weekDays;
Expand Down Expand Up @@ -730,9 +732,9 @@ angular.module('AngularScheduler', ['underscore'])
month = $filter('schZeroPad')(dt.getMonth() + 1, 2);
day = $filter('schZeroPad')(dt.getDate(), 2);
scope.schedulerStartDt = month + '/' + day + '/' + dt.getFullYear();
scope.schedulerStartHour = dt.getHours(); //$filter('schZeroPad')(dt.getHours(),2);
scope.schedulerStartMinute = dt.getMinutes(); // $filter('schZeroPad')(dt.getMinutes(),2);
scope.schedulerStartSecond = dt.getSeconds(); // $filter('schZeroPad')(dt.getSeconds(),2);
scope.schedulerStartHour = $filter('schZeroPad')(dt.getHours(),2);
scope.schedulerStartMinute = $filter('schZeroPad')(dt.getMinutes(),2);
scope.schedulerStartSecond = $filter('schZeroPad')(dt.getSeconds(),2);
scope.scheduleTimeChange(); // calc UTC
}
else {
Expand All @@ -741,9 +743,9 @@ angular.module('AngularScheduler', ['underscore'])
return p2 + '/' + p3 + '/' + p1;
});
timeString = value.replace(/^.*T/,'');
scope.schedulerStartHour = timeString.substr(0,2);
scope.schedulerStartMinute = timeString.substr(3,2);
scope.schedulerStartSecond = timeString.substr(6,2);
scope.schedulerStartHour = $filter('schZeroPad')(timeString.substr(0,2),2);
scope.schedulerStartMinute = $filter('schZeroPad')(timeString.substr(3,2),2);
scope.schedulerStartSecond = $filter('schZeroPad')(timeString.substr(6,2),2);
}
scope.scheduleTimeChange();
}
Expand Down
Loading

0 comments on commit 5f41311

Please sign in to comment.