aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin Wells2013-05-07 22:58:05 +0100
committerPete Bacon Darwin2013-05-07 22:59:46 +0100
commit4f2e36068502f18814fee0abd26951124881f951 (patch)
tree7d15c61192697ac787cf575288eefbfc1d9b5cb0 /src
parent4622af3f075204e2d5ab33d5bd002074f2d940c9 (diff)
downloadangular.js-4f2e36068502f18814fee0abd26951124881f951.tar.bz2
fix(date): correctly format dates with more than 3 sub-second digits
This date {{2003-09-10T13:02:03.123456Z | date: yyyy-mm-dd ss} is now treated as having 123.45ms. Previously it had 123456ms so 123 seconds were added to the formatted date. Use local date in unit tests so they work in any time zone
Diffstat (limited to 'src')
-rw-r--r--src/ng/filter/filters.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ng/filter/filters.js b/src/ng/filter/filters.js
index 3830e965..e03d59d7 100644
--- a/src/ng/filter/filters.js
+++ b/src/ng/filter/filters.js
@@ -356,7 +356,11 @@ function dateFilter($locale) {
tzMin = int(match[9] + match[11]);
}
dateSetter.call(date, int(match[1]), int(match[2]) - 1, int(match[3]));
- timeSetter.call(date, int(match[4]||0) - tzHour, int(match[5]||0) - tzMin, int(match[6]||0), int(match[7]||0));
+ var h = int(match[4]||0) - tzHour;
+ var m = int(match[5]||0) - tzMin
+ var s = int(match[6]||0);
+ var ms = Math.round(parseFloat('0.' + (match[7]||0)) * 1000);
+ timeSetter.call(date, h, m, s, ms);
return date;
}
return string;