{"action":"created","issue":{"url":"https://api.github.com/repos/moment/moment/issues/3622","repository_url":"https://api.github.com/repos/moment/moment","labels_url":"https://api.github.com/repos/moment/moment/issues/3622/labels{/name}","comments_url":"https://api.github.com/repos/moment/moment/issues/3622/comments","events_url":"https://api.github.com/repos/moment/moment/issues/3622/events","html_url":"https://github.com/moment/moment/issues/3622","id":191478657,"number":3622,"title":"validating positively for a missing timezone","user":{"login":"sebs","id":55102,"avatar_url":"https://avatars.githubusercontent.com/u/55102?v=3","gravatar_id":"","url":"https://api.github.com/users/sebs","html_url":"https://github.com/sebs","followers_url":"https://api.github.com/users/sebs/followers","following_url":"https://api.github.com/users/sebs/following{/other_user}","gists_url":"https://api.github.com/users/sebs/gists{/gist_id}","starred_url":"https://api.github.com/users/sebs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebs/subscriptions","organizations_url":"https://api.github.com/users/sebs/orgs","repos_url":"https://api.github.com/users/sebs/repos","events_url":"https://api.github.com/users/sebs/events{/privacy}","received_events_url":"https://api.github.com/users/sebs/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-24T10:04:48Z","updated_at":"2016-11-28T00:30:35Z","closed_at":"2016-11-28T00:30:35Z","body":"Came by this in a discussion, we opened a bug report. Probably a isse. \r\n\r\n\r\n**Description of the Issue and Steps to Reproduce:**\r\n\r\n1. Validating a ISO 8601 formatted date without timezone declaration in non-strict mode always results as true even when the timezone is missing. Validating in strict mode is not an alternative because then the entire date must be mapped, which can't be done in case the exact formatting of the remainder of the date isn't known at programming time.\r\n\r\n```js\r\nimport { module, test } from '../qunit';\r\nimport moment from '../../moment';\r\n\r\nmodule('bugreport');\r\n\r\ntest('validating positively for a missing timezone', function (assert) {\r\n    var validated = moment(\"2097-07-16T19:20:30.45\", 'Z').isValid();\r\n    assert.notOk(validated, 'We expect a date without a expressively mentioned timezone as invalid');\r\n});\r\n\r\n```\r\n\r\n*Please include the values of all variables used.*\r\n\r\n**Environment:**\r\n\r\n* unit test suite\r\n\r\n*Examples: Chrome 49 on OSX, Internet Explorer 10 on Windows 7, Node.JS 4.4.4 on Ubuntu 16.0.4*\r\n\r\n*Both the browser and the OS are important to us, particularly if you have an unsual environment like an IOT application.*\r\n\r\n**Other information that may be helpful:**\r\n* The time zone setting of the machine the code is running on\r\n* The time and date at which the code was run\r\n* Other libraries in use (TypeScript, Immutable.js, etc)\r\n\r\nIf you are reporting an issue, please run the following code in the environment you are using and include the output:\r\n```js\r\nconsole.log( (new Date()).toString())\r\nconsole.log((new Date()).toLocaleString())\r\nconsole.log( (new Date()).getTimezoneOffset())\r\n\r\nThu Nov 24 2016 11:03:09 GMT+0100 (CET)\r\n2016-11-24 11:03:09\r\n-60\r\n```\r\n\r\nnode.js / moment - latest development master \r\n\r\n\r\n*Ensure your issue is isolated to moment. Issues involving third party tools will be closed unless submitted by the tool's author/maintainer.*"},"comment":{"url":"https://api.github.com/repos/moment/moment/issues/comments/263159510","html_url":"https://github.com/moment/moment/issues/3622#issuecomment-263159510","issue_url":"https://api.github.com/repos/moment/moment/issues/3622","id":263159510,"user":{"login":"maggiepint","id":6054610,"avatar_url":"https://avatars.githubusercontent.com/u/6054610?v=3","gravatar_id":"","url":"https://api.github.com/users/maggiepint","html_url":"https://github.com/maggiepint","followers_url":"https://api.github.com/users/maggiepint/followers","following_url":"https://api.github.com/users/maggiepint/following{/other_user}","gists_url":"https://api.github.com/users/maggiepint/gists{/gist_id}","starred_url":"https://api.github.com/users/maggiepint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maggiepint/subscriptions","organizations_url":"https://api.github.com/users/maggiepint/orgs","repos_url":"https://api.github.com/users/maggiepint/repos","events_url":"https://api.github.com/users/maggiepint/events{/privacy}","received_events_url":"https://api.github.com/users/maggiepint/received_events","type":"User","site_admin":false},"created_at":"2016-11-28T00:30:35Z","updated_at":"2016-11-28T00:30:35Z","body":"What I think you are saying here is that you believe that an ISO8601 date must always include an offset. That is not the case. Per the standard, you can omit the offset, in which case the timestamp is interpreted as local time.\r\n\r\nIt is worth noting that an offset is not a time zone - I live in the America/Los_Angeles time zone, which sometimes has an offset of -8:00 and sometimes -7:00.\r\n\r\nIf you wanted to specifically validate the existence of an offset, then the following code would do the trick:\r\n\r\n```\r\nmoment(\"2097-07-16T19:20:30.45\", 'YYYY-MM-DDTHH:mm:ss.SSZ', true).isValid();\r\nfalse\r\n```"}}
{"actor":{"display_login":"maggiepint"}}