Skip to content

Commit 76f6124

Browse files
authored
Merge pull request #4 from angeltrax/master
Allow specifying date format
2 parents a55ac86 + 44eedcd commit 76f6124

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ For both date and time input
6666
| date | moment.js datetime object or a datetime string | none | no |
6767
| time | moment.js datetime object or a datetime string | none | no |
6868
| datetime | moment.js datetime object or a datetime string | none | no |
69+
| format | moment.js compatible date/time format | none | no |
6970
| placeholder | Placeholder is shown when input object is undefined | none | no |
7071
| on-change | Handler function that is fired on change of datetime object | none | no |
7172

dist/datetime-inputs.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/date-input.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ directive('dateInput', ['$document', function ($document) {
99
restrict: 'E',
1010
scope: {
1111
date: '=',
12+
format: '=?',
1213
onChange: '&',
1314
placeholder: '@'
1415
},
@@ -53,7 +54,7 @@ directive('dateInput', ['$document', function ($document) {
5354

5455
// Convert date object to moment.js if its not a moment object yet
5556
if ( scope.date && !scope.date._isAMomentObject ) {
56-
scope.date = moment(scope.date);
57+
scope.date = moment(scope.date, scope.format);
5758
}
5859

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

0 commit comments

Comments
 (0)