aboutsummaryrefslogtreecommitdiffstats
path: root/src/apis.js
diff options
context:
space:
mode:
authorIgor Minar2010-11-08 09:52:09 -0800
committerIgor Minar2010-11-08 22:49:30 -0800
commitda17c614441c28907047442997bd4d99cdc6eaa1 (patch)
tree2138adb7123867a5d16704b9c9e43b5a342e7313 /src/apis.js
parente5c135ac50bfb463895c71a9b83267e9ca836c7b (diff)
downloadangular.js-da17c614441c28907047442997bd4d99cdc6eaa1.tar.bz2
angular.Date.toString should use toISOString if available
Diffstat (limited to 'src/apis.js')
-rw-r--r--src/apis.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/apis.js b/src/apis.js
index effb70d7..f8deb6ae 100644
--- a/src/apis.js
+++ b/src/apis.js
@@ -223,14 +223,17 @@ var angularString = {
var angularDate = {
'toString':function(date){
- return !date ? date :
- padNumber(date.getUTCFullYear(), 4) + '-' +
- padNumber(date.getUTCMonth() + 1, 2) + '-' +
- padNumber(date.getUTCDate(), 2) + 'T' +
- padNumber(date.getUTCHours(), 2) + ':' +
- padNumber(date.getUTCMinutes(), 2) + ':' +
- padNumber(date.getUTCSeconds(), 2) + '.' +
- padNumber(date.getUTCMilliseconds(), 3) + 'Z';
+ return !date ?
+ date :
+ date.toISOString ?
+ date.toISOString() :
+ padNumber(date.getUTCFullYear(), 4) + '-' +
+ padNumber(date.getUTCMonth() + 1, 2) + '-' +
+ padNumber(date.getUTCDate(), 2) + 'T' +
+ padNumber(date.getUTCHours(), 2) + ':' +
+ padNumber(date.getUTCMinutes(), 2) + ':' +
+ padNumber(date.getUTCSeconds(), 2) + '.' +
+ padNumber(date.getUTCMilliseconds(), 3) + 'Z';
}
};