Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Timezone offset bug #1261

Closed
Closed
@benpriebe

Description

@benpriebe

When I hit my site from a +1000 timezone and run the date through a $filter with the Z timezone formatter I get a -1000 timezone.

e.g.

var now = new Date(); // Fri Aug 10 2012 14:00:00 GMT+1000
var created = $filter('date')(now, "yyyy-MM-ddTHH:mm:ss.000Z");

Which equals:

"2012-08-10T14:00:00.000-1000"

I would expect it to equal:

"2012-08-10T14:00:00.000+1000"

If my understanding is not flawed, then this is the method that has the bug.

around line: 9805 (angular.js 1.0.1)

function timeZoneGetter(date) {
    var offset = date.getTimezoneOffset();
    return padNumber(offset / 60, 2) + padNumber(Math.abs(offset % 60), 2);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions