{"action":"opened","issue":{"url":"https://api.github.com/repos/malko/date-functions/issues/1","labels_url":"https://api.github.com/repos/malko/date-functions/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/malko/date-functions/issues/1/comments","events_url":"https://api.github.com/repos/malko/date-functions/issues/1/events","html_url":"https://github.com/malko/date-functions/issues/1","id":123515881,"number":1,"title":"Bad handling of negative timezone offset in getGMTOffset","user":{"login":"jlowcs","id":3777724,"avatar_url":"https://avatars.githubusercontent.com/u/3777724?v=3","gravatar_id":"","url":"https://api.github.com/users/jlowcs","html_url":"https://github.com/jlowcs","followers_url":"https://api.github.com/users/jlowcs/followers","following_url":"https://api.github.com/users/jlowcs/following{/other_user}","gists_url":"https://api.github.com/users/jlowcs/gists{/gist_id}","starred_url":"https://api.github.com/users/jlowcs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlowcs/subscriptions","organizations_url":"https://api.github.com/users/jlowcs/orgs","repos_url":"https://api.github.com/users/jlowcs/repos","events_url":"https://api.github.com/users/jlowcs/events{/privacy}","received_events_url":"https://api.github.com/users/jlowcs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-22T16:44:38Z","updated_at":"2015-12-22T16:44:38Z","closed_at":null,"body":"``date.getGMTOffset()`` returns ``+-100`` in GMT+1 timezone. This is easily fixed by using ``Math.abs``:\r\n\r\n```javascript\r\n\tDate.prototype.getGMTOffset = function() {\r\n\t\treturn (this.getTimezoneOffset() > 0 ? \"-\" : \"+\")\r\n\t\t\t+ stringLeftPad(Math.floor(Math.abs(this.getTimezoneOffset()) / 60), 2, \"0\")\r\n\t\t\t+ stringLeftPad(Math.abs(this.getTimezoneOffset()) % 60, 2, \"0\");\r\n\t};\r\n```"}}