Skip to content

Commit

Permalink
Format UTC date only if specified with { timeZone: "UTC" } (fixes #59)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyearnshaw committed Feb 5, 2014
1 parent 6029ad3 commit bc17e4c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
19 changes: 10 additions & 9 deletions Intl.complete.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions Intl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2569,20 +2569,21 @@ function ToLocalTime(date, calendar, timeZone) {
// for local time zone adjustment and daylight saving time adjustment imposed by
// ES5, 15.9.1.7 and 15.9.1.8.
// ###TODO###
var d = new Date(date);
var d = new Date(date),
m = 'get' + (timeZone || '');

// 2. Return a Record with fields [[weekday]], [[era]], [[year]], [[month]], [[day]],
// [[hour]], [[minute]], [[second]], and [[inDST]], each with the corresponding
// calculated value.
return new Record({
'[[weekday]]': d.getUTCDay(),
'[[era]]' : +(d.getUTCFullYear() >= 0),
'[[year]]' : d.getUTCFullYear(),
'[[month]]' : d.getUTCMonth(),
'[[day]]' : d.getUTCDate(),
'[[hour]]' : d.getUTCHours(),
'[[minute]]' : d.getUTCMinutes(),
'[[second]]' : d.getUTCSeconds(),
'[[weekday]]': d[m + 'Day'](),
'[[era]]' : +(d[m + 'FullYear']() >= 0),
'[[year]]' : d[m + 'FullYear'](),
'[[month]]' : d[m + 'Month'](),
'[[day]]' : d[m + 'Date'](),
'[[hour]]' : d[m + 'Hours'](),
'[[minute]]' : d[m + 'Minutes'](),
'[[second]]' : d[m + 'Seconds'](),
'[[inDST]]' : false // ###TODO###
});
}
Expand Down
Loading

0 comments on commit bc17e4c

Please sign in to comment.