Skip to content

Commit a5d4397

Browse files
committed
Moved start/end date conversion to moment js objects up.
1 parent e20d12c commit a5d4397

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/datetime-range.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ angular.module('g1b.datetime-range', []).
2424
// Get current date
2525
scope.current = moment();
2626

27+
// Convert start datetime to moment.js if its not a moment object yet
28+
if ( scope.start && !scope.start._isAMomentObject ) {
29+
scope.start = moment(scope.start);
30+
}
31+
32+
// Convert end datetime to moment.js if its not a moment object yet
33+
if ( scope.end && !scope.end._isAMomentObject ) {
34+
scope.end = moment(scope.end);
35+
}
36+
2737
// Set selected date
2838
scope.selectDate = function (date) {
2939
if ( scope.selected === date ) {
@@ -81,16 +91,6 @@ angular.module('g1b.datetime-range', []).
8191
}
8292
};
8393

84-
// Convert start datetime to moment.js if its not a moment object yet
85-
if ( scope.start && !scope.start._isAMomentObject ) {
86-
scope.start = moment(scope.start);
87-
}
88-
89-
// Convert end datetime to moment.js if its not a moment object yet
90-
if ( scope.end && !scope.end._isAMomentObject ) {
91-
scope.end = moment(scope.end);
92-
}
93-
9494
// Close edit popover
9595
scope.close = function () {
9696
scope.selected = '';

0 commit comments

Comments
 (0)