mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
fix(timezone): correct timezone date filter for 1/2 hour offsets
This commit is contained in:
parent
654dd1d5e8
commit
7d4ccea579
2 changed files with 10 additions and 1 deletions
|
|
@ -214,7 +214,8 @@ function timeZoneGetter(date) {
|
|||
var zone = -1 * date.getTimezoneOffset();
|
||||
var paddedZone = (zone >= 0) ? "+" : "";
|
||||
|
||||
paddedZone += padNumber(zone / 60, 2) + padNumber(Math.abs(zone % 60), 2);
|
||||
paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
|
||||
padNumber(Math.abs(zone % 60), 2);
|
||||
|
||||
return paddedZone;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,6 +227,8 @@ describe('filters', function() {
|
|||
var utc = new angular.mock.TzDate( 0, '2010-09-03T12:05:08.000Z');
|
||||
var eastOfUTC = new angular.mock.TzDate(-5, '2010-09-03T12:05:08.000Z');
|
||||
var westOfUTC = new angular.mock.TzDate(+5, '2010-09-03T12:05:08.000Z');
|
||||
var eastOfUTCPartial = new angular.mock.TzDate(-5.5, '2010-09-03T12:05:08.000Z');
|
||||
var westOfUTCPartial = new angular.mock.TzDate(+5.5, '2010-09-03T12:05:08.000Z');
|
||||
|
||||
expect(date(utc, "yyyy-MM-ddTHH:mm:ssZ")).
|
||||
toEqual('2010-09-03T12:05:08+0000')
|
||||
|
|
@ -236,6 +238,12 @@ describe('filters', function() {
|
|||
|
||||
expect(date(westOfUTC, "yyyy-MM-ddTHH:mm:ssZ")).
|
||||
toEqual('2010-09-03T07:05:08-0500')
|
||||
|
||||
expect(date(eastOfUTCPartial, "yyyy-MM-ddTHH:mm:ssZ")).
|
||||
toEqual('2010-09-03T17:35:08+0530')
|
||||
|
||||
expect(date(westOfUTCPartial, "yyyy-MM-ddTHH:mm:ssZ")).
|
||||
toEqual('2010-09-03T06:35:08-0530')
|
||||
});
|
||||
|
||||
it('should treat single quoted strings as string literals', function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue