aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorIgor Minar2010-11-08 10:51:28 -0800
committerIgor Minar2010-11-08 22:49:30 -0800
commitfc9ce9ec075aa21cdf6a79987e4aa152991f6a44 (patch)
treed68ea23ebb8682dcccafe3890d8ff70d07a23a09 /test
parentda17c614441c28907047442997bd4d99cdc6eaa1 (diff)
downloadangular.js-fc9ce9ec075aa21cdf6a79987e4aa152991f6a44.tar.bz2
make angular.String.toDate consider all time fractions as optional
Diffstat (limited to 'test')
-rw-r--r--test/ApiSpecs.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ApiSpecs.js b/test/ApiSpecs.js
index 344cf5da..81fd9155 100644
--- a/test/ApiSpecs.js
+++ b/test/ApiSpecs.js
@@ -190,8 +190,25 @@ describe('api', function(){
});
it('UTCtoDate', function(){
+ //full ISO8061
expect(angular.String.toDate("2003-09-10T13:02:03.000Z")).
toEqual(new Date("Sep 10 2003 13:02:03 GMT"));
+
+ //no millis
+ expect(angular.String.toDate("2003-09-10T13:02:03Z")).
+ toEqual(new Date("Sep 10 2003 13:02:03 GMT"));
+
+ //no seconds
+ expect(angular.String.toDate("2003-09-10T13:02Z")).
+ toEqual(new Date("Sep 10 2003 13:02:00 GMT"));
+
+ //no minutes
+ expect(angular.String.toDate("2003-09-10T13Z")).
+ toEqual(new Date("Sep 10 2003 13:00:00 GMT"));
+
+ //no time
+ expect(angular.String.toDate("2003-09-10")).
+ toEqual(new Date("Sep 10 2003 00:00:00 GMT"));
});
it('StringFromUTC', function(){