mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
angular.Date.toString should use toISOString if available
This commit is contained in:
parent
e5c135ac50
commit
da17c61444
1 changed files with 11 additions and 8 deletions
19
src/apis.js
19
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';
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue