Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f2722b5

Browse files
committedDec 10, 2016
fix(dateparser): add new date format for angular 1.5+ only
- Only add parsing ability for new date format for angular 1.5+ Fixes #6349
1 parent 57ed7e4 commit f2722b5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed
 

Diff for: ‎src/dateparser/dateparser.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ angular.module('ui.bootstrap.dateparser', [])
8181
apply: function(value) { this.month = value - 1; },
8282
formatter: function(date) { return dateFilter(date, 'M'); }
8383
},
84-
{
85-
key: 'LLLL',
86-
regex: $locale.DATETIME_FORMATS.STANDALONEMONTH.join('|'),
87-
apply: function(value) { this.month = $locale.DATETIME_FORMATS.STANDALONEMONTH.indexOf(value); },
88-
formatter: function(date) { return dateFilter(date, 'LLLL'); }
89-
},
9084
{
9185
key: 'd!',
9286
regex: '[0-2]?[0-9]{1}|3[0-1]{1}',
@@ -236,6 +230,15 @@ angular.module('ui.bootstrap.dateparser', [])
236230
formatter: function(date) { return dateFilter(date, 'G'); }
237231
}
238232
];
233+
234+
if (angular.version.major >= 1 && angular.version.minor > 4) {
235+
formatCodeToRegex.push({
236+
key: 'LLLL',
237+
regex: $locale.DATETIME_FORMATS.STANDALONEMONTH.join('|'),
238+
apply: function(value) { this.month = $locale.DATETIME_FORMATS.STANDALONEMONTH.indexOf(value); },
239+
formatter: function(date) { return dateFilter(date, 'LLLL'); }
240+
});
241+
}
239242
};
240243

241244
this.init();

0 commit comments

Comments
 (0)
This repository has been archived.