Merge pull request #1098 from metamx/Enable_full_iso8601_durations_in_console

better regex for durations
This commit is contained in:
Fangjin Yang 2015-02-06 17:30:45 -08:00
commit 9f353ca2bd
1 changed files with 12 additions and 12 deletions

View File

@ -11829,7 +11829,7 @@ app.directive('isoDuration', function() {
require: 'ngModel', require: 'ngModel',
link: function($scope, $el, $attrs, $ctrl) { link: function($scope, $el, $attrs, $ctrl) {
var durationRegex; var durationRegex;
durationRegex = /^P(((\d+)Y)?((\d)+M)?((\d)+D)?|(\d)+W)$/; durationRegex = /^P(?=\w*\d)(?:\d+Y|Y)?(?:\d+M|M)?(?:\d+W|W)?(?:\d+D|D)?(?:T(?:\d+H|H)?(?:\d+M|M)?(?:\d+(?:\­.\d{1,2})?S|S)?)?$/;
return $ctrl.$parsers.unshift(function(viewValue) { return $ctrl.$parsers.unshift(function(viewValue) {
if (viewValue == null) { if (viewValue == null) {
$ctrl.$setValidity('isoDuration', true); $ctrl.$setValidity('isoDuration', true);