aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIwein Fuld2012-08-30 06:39:52 +0200
committerMisko Hevery2012-09-06 16:06:23 -0700
commit9473780e77a960ba27644ca76c2413924cc8972e (patch)
tree10f54e3fb0bba365c9aa3190093a69b1ade62fcd /src
parenteb5fd400d34ea9c6e5ce1e76dffd9b40f412763a (diff)
downloadangular.js-9473780e77a960ba27644ca76c2413924cc8972e.tar.bz2
fix(dateFilter): make timezone optional
Makes the time zone optional in the date filter Problem with the current R_ISO8601_STR regex was that the time was optional, but the zone was not. This results in the filter not formatting local date times, which it could easily do. For example: 2012-08-30 -> formatted 2012-08-30T06:06:06.123Z -> formatted 2012-08-30T06:06:06.123 -> NOT formatted A simple change in the regex fixes this. Arguably this is closer to the ISO8601 spec which specifies local dates being in the "current time zone" and not requiring a Z. In any case it behaves more like a user would expect.
Diffstat (limited to 'src')
-rw-r--r--src/ng/filter/filters.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ng/filter/filters.js b/src/ng/filter/filters.js
index b3792171..376afd85 100644
--- a/src/ng/filter/filters.js
+++ b/src/ng/filter/filters.js
@@ -320,7 +320,7 @@ dateFilter.$inject = ['$locale'];
function dateFilter($locale) {
- var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/;
+ var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
function jsonStringToDate(string){
var match;
if (match = string.match(R_ISO8601_STR)) {