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

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);
}

Activity

  1. pkozlowski-opensource commented on Nov 24, 2012

    @pkozlowski-opensource
    Member

    @benpriebe Seems like a bug to me too. Looking at http://www.w3.org/TR/NOTE-datetime it states:

    Times are expressed in local time, together with a time zone offset in hours and minutes. A time zone offset of "+hh:mm" indicates that the date/time uses a local time zone which is "hh" hours and "mm" minutes ahead of UTC. A time zone offset of "-hh:mm" indicates that the date/time uses a local time zone which is "hh" hours and "mm" minutes behind UTC.

  2. pkozlowski-opensource commented on Dec 2, 2012

    @pkozlowski-opensource
    Member

    Definitively a duplicate of #1532

    2 issues as far as I can tell:

    • +/- signs are flipped
    • + sign is never added

    Going to close this one so we can focus on addressing #1532

  3. added 2 commits that reference this issue on Feb 7, 2013
    b001c8e
    8d34bf2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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