{"action":"created","issue":{"url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7053","repository_url":"https://api.github.com/repos/HabitRPG/habitrpg","labels_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7053/labels{/name}","comments_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7053/comments","events_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7053/events","html_url":"https://github.com/HabitRPG/habitrpg/pull/7053","id":147169209,"number":7053,"title":"fix: Change from moment.zone to moment.utcOffset to fix warnings","user":{"login":"crookedneighbor","id":2916945,"avatar_url":"https://avatars.githubusercontent.com/u/2916945?v=3","gravatar_id":"","url":"https://api.github.com/users/crookedneighbor","html_url":"https://github.com/crookedneighbor","followers_url":"https://api.github.com/users/crookedneighbor/followers","following_url":"https://api.github.com/users/crookedneighbor/following{/other_user}","gists_url":"https://api.github.com/users/crookedneighbor/gists{/gist_id}","starred_url":"https://api.github.com/users/crookedneighbor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crookedneighbor/subscriptions","organizations_url":"https://api.github.com/users/crookedneighbor/orgs","repos_url":"https://api.github.com/users/crookedneighbor/repos","events_url":"https://api.github.com/users/crookedneighbor/events{/privacy}","received_events_url":"https://api.github.com/users/crookedneighbor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-09T22:21:17Z","updated_at":"2016-04-10T09:35:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7053","html_url":"https://github.com/HabitRPG/habitrpg/pull/7053","diff_url":"https://github.com/HabitRPG/habitrpg/pull/7053.diff","patch_url":"https://github.com/HabitRPG/habitrpg/pull/7053.patch"},"body":"### Problem\r\n\r\nMoment deprecated the use of `moment().zone` in favor of `moment().utcOffset`. So we're getting deprecation warnings on the server and client. HOWEVER, it is not just a rename. See this note from the `utcOffset` docs:\r\n\r\n> **NOTE:** Unlike `moment.fn.zone` this function returns the real offset from UTC, not the reverse offset (as returned by `Date.prototype.getTimezoneOffset`).\r\n\r\nSo we may need to test and make some adjustments before merging this in. \r\n\r\n@Alys @SabreCat @paglias "},"comment":{"url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/comments/207950843","html_url":"https://github.com/HabitRPG/habitrpg/pull/7053#issuecomment-207950843","issue_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7053","id":207950843,"user":{"login":"Alys","id":1495809,"avatar_url":"https://avatars.githubusercontent.com/u/1495809?v=3","gravatar_id":"","url":"https://api.github.com/users/Alys","html_url":"https://github.com/Alys","followers_url":"https://api.github.com/users/Alys/followers","following_url":"https://api.github.com/users/Alys/following{/other_user}","gists_url":"https://api.github.com/users/Alys/gists{/gist_id}","starred_url":"https://api.github.com/users/Alys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alys/subscriptions","organizations_url":"https://api.github.com/users/Alys/orgs","repos_url":"https://api.github.com/users/Alys/repos","events_url":"https://api.github.com/users/Alys/events{/privacy}","received_events_url":"https://api.github.com/users/Alys/received_events","type":"User","site_admin":false},"created_at":"2016-04-10T09:35:37Z","updated_at":"2016-04-10T09:35:37Z","body":"We should definitely change from `zone()` to `utcOffset()`, but I think it might need to be introduced more slowly with a cutover period where cron can run using either function (with each associated zone value stored in separate `preferences` attributes). If functions return different values, then we'll get bugs if cron is using only `utcOffset()` but if the user's stored `preferences.timezoneOffset` value was set using `zone()`.\r\n\r\nThis won't be a problem when the new cron code runs immediately after the user reloads or logs in to Habitica on a web browser (because the new code in common/script/public/userServices.js will pick up the correct utcOffset value), but if the new cron code runs before `preferences.timezoneOffset` has been adjusted, I think we'll get bugs - this could happen if cron runs on a browser that hasn't been reloaded recently, or runs when a third-party tool connects to the server, or runs from an older version of the mobile apps.\r\n\r\nIn fact I think the apps will need to be adjusted to match, since they send the timezone to the server, and their current code presumably uses the same values that `zone()` gives.\r\n\r\nI'm wondering if it's worth delaying this until after we've introduced some cron-related changes that are being considered, because they might give us more control over when cron is run."}}