moment-parseformat
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -59,2 +59,4 @@ /* istanbul ignore next */ | ||
var formatIncludesMonth = /([\/][M]|[M][\/]|[MM]|[MMMM])/ | ||
var regexFillingWords = /\b(at)\b/i | ||
@@ -166,2 +168,11 @@ | ||
// to prevent 9.20 gets formated to D.Y, we format the complete date first, then go for the time | ||
if (format.match(formatIncludesMonth)) { | ||
var regexHoursDotWithLeadingZeroOrDoubleDigitMinutes = /0\d.\d{2}|\d{2}.\d{2}/ | ||
var regexHoursDotMinutes = /\d{1}.\d{2}/ | ||
format = format.replace(regexHoursDotWithLeadingZeroOrDoubleDigitMinutes, 'H.mm') | ||
format = format.replace(regexHoursDotMinutes, 'h.mm') | ||
} | ||
// now, the next number, if existing, must be a day | ||
@@ -168,0 +179,0 @@ format = format.replace(regexDayLeadingZero, 'DD') |
@@ -41,3 +41,3 @@ { | ||
}, | ||
"version": "1.1.2" | ||
"version": "1.1.3" | ||
} |
@@ -76,3 +76,9 @@ 'use strict' | ||
// https://github.com/gr2m/moment-parseformat/issues/19 | ||
t.equal(moment.parseFormat('February 6th, 2014 9.20'), 'MMMM Do, YYYY h.mm', 'February 6th, 2014 9.20 → MMMM Do, YYYY h.mm') | ||
t.equal(moment.parseFormat('2.2.2014 09.20'), 'D.M.YYYY H.mm', '2.2.2014 09.20 → D.M.YYYY H.mm') | ||
t.equal(moment.parseFormat('2.2.2014 11.20'), 'D.M.YYYY H.mm', '2.2.2014 11.20 → D.M.YYYY H.mm') | ||
t.equal(moment.parseFormat('2.2.2014 9.02'), 'D.M.YYYY h.mm', '2.2.2014 9.02 → D.M.YYYY h.mm') | ||
t.end() | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23703
262