Skip to content

Commit 256e5c5

Browse files
committed
Convert provided datetime objects to moment js in case they are not moment js objects yet.
1 parent 28f4cb6 commit 256e5c5

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/datetime-input.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,9 @@ angular.module('g1b.datetime-input', []).
3939
scope.handler();
4040
};
4141

42-
// Convert start datetime to moment.js if its not a moment object yet
43-
if ( scope.start && !scope.start._isAMomentObject ) {
44-
scope.start = moment(scope.start);
45-
}
46-
47-
// Convert end datetime to moment.js if its not a moment object yet
48-
if ( scope.end && !scope.end._isAMomentObject ) {
49-
scope.end = moment(scope.end);
42+
// Convert datetime object to moment.js if its not a moment object yet
43+
if ( scope.datetime && !scope.datetime._isAMomentObject ) {
44+
scope.datetime = moment(scope.datetime);
5045
}
5146

5247
// Bind click events outside directive to close edit popover

0 commit comments

Comments
 (0)