Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
fix(dateparser): add new date format for angular 1.5+ only
Browse files Browse the repository at this point in the history
- Only add parsing ability for new date format for angular 1.5+

Fixes #6349
  • Loading branch information
wesleycho committed Dec 10, 2016
1 parent 57ed7e4 commit f2722b5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/dateparser/dateparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ angular.module('ui.bootstrap.dateparser', [])
apply: function(value) { this.month = value - 1; },
formatter: function(date) { return dateFilter(date, 'M'); }
},
{
key: 'LLLL',
regex: $locale.DATETIME_FORMATS.STANDALONEMONTH.join('|'),
apply: function(value) { this.month = $locale.DATETIME_FORMATS.STANDALONEMONTH.indexOf(value); },
formatter: function(date) { return dateFilter(date, 'LLLL'); }
},
{
key: 'd!',
regex: '[0-2]?[0-9]{1}|3[0-1]{1}',
Expand Down Expand Up @@ -236,6 +230,15 @@ angular.module('ui.bootstrap.dateparser', [])
formatter: function(date) { return dateFilter(date, 'G'); }
}
];

if (angular.version.major >= 1 && angular.version.minor > 4) {
formatCodeToRegex.push({
key: 'LLLL',
regex: $locale.DATETIME_FORMATS.STANDALONEMONTH.join('|'),
apply: function(value) { this.month = $locale.DATETIME_FORMATS.STANDALONEMONTH.indexOf(value); },
formatter: function(date) { return dateFilter(date, 'LLLL'); }
});
}
};

this.init();
Expand Down

0 comments on commit f2722b5

Please sign in to comment.