{"action":"created","issue":{"url":"https://api.github.com/repos/moment/moment/issues/1754","repository_url":"https://api.github.com/repos/moment/moment","labels_url":"https://api.github.com/repos/moment/moment/issues/1754/labels{/name}","comments_url":"https://api.github.com/repos/moment/moment/issues/1754/comments","events_url":"https://api.github.com/repos/moment/moment/issues/1754/events","html_url":"https://github.com/moment/moment/issues/1754","id":37054536,"number":1754,"title":"make moment mostly immutable","user":{"login":"ichernev","id":757060,"avatar_url":"https://avatars.githubusercontent.com/u/757060?v=3","gravatar_id":"","url":"https://api.github.com/users/ichernev","html_url":"https://github.com/ichernev","followers_url":"https://api.github.com/users/ichernev/followers","following_url":"https://api.github.com/users/ichernev/following{/other_user}","gists_url":"https://api.github.com/users/ichernev/gists{/gist_id}","starred_url":"https://api.github.com/users/ichernev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ichernev/subscriptions","organizations_url":"https://api.github.com/users/ichernev/orgs","repos_url":"https://api.github.com/users/ichernev/repos","events_url":"https://api.github.com/users/ichernev/events{/privacy}","received_events_url":"https://api.github.com/users/ichernev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/moment/moment/labels/Enhancement","name":"Enhancement","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/moment/moment/milestones/15","html_url":"https://github.com/moment/moment/milestones/3.0","labels_url":"https://api.github.com/repos/moment/moment/milestones/15/labels","id":555799,"number":15,"title":"3.0","description":"Next major","creator":{"login":"ichernev","id":757060,"avatar_url":"https://avatars.githubusercontent.com/u/757060?v=3","gravatar_id":"","url":"https://api.github.com/users/ichernev","html_url":"https://github.com/ichernev","followers_url":"https://api.github.com/users/ichernev/followers","following_url":"https://api.github.com/users/ichernev/following{/other_user}","gists_url":"https://api.github.com/users/ichernev/gists{/gist_id}","starred_url":"https://api.github.com/users/ichernev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ichernev/subscriptions","organizations_url":"https://api.github.com/users/ichernev/orgs","repos_url":"https://api.github.com/users/ichernev/repos","events_url":"https://api.github.com/users/ichernev/events{/privacy}","received_events_url":"https://api.github.com/users/ichernev/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":1,"state":"open","created_at":"2014-02-01T20:30:00Z","updated_at":"2016-04-02T01:17:03Z","due_on":null,"closed_at":null},"comments":116,"created_at":"2014-07-03T07:58:14Z","updated_at":"2016-05-23T19:56:11Z","closed_at":null,"body":"There has been [a lot of discussions](https://github.com/moment/moment/search?q=immutable&ref=cmdform&type=Issues) about this. Here's the proposal:\r\n\r\nThe following mutable methods will become immutable in 3.0.0: `utc`, `local`, `zone`, `add`, `subtract`, `startOf`, `endOf`, `lang`, also in `duration`: `add`, `subtract`, and `lang`.\r\n\r\nAs a start, all methods will be duplicated with `methodNameMute` variants. We also need immutable variants named `methodNameImmute`. From 3.0 the plain old methods will start using the immutable option by default.\r\n\r\nWhat is debatable is:\r\n* should `lang` be made immutable\r\n* should all the getters/setters (including `get`/`set`) be made immutable too\r\n* naming of the mutable and immutable versions of the methods\r\n* and of course -- should we do the switch, or just stop at the immutable API\r\n\r\nThe good part is we can make immutable versions of the methods today and decide later on what to do. If we switch it would also mean the `2.x` branch would be around for quite some time after `3.x` is out.\r\n\r\n@icambron @timrwood @gregwebs @yang @lfnavess @soswow @langalex"},"comment":{"url":"https://api.github.com/repos/moment/moment/issues/comments/221077737","html_url":"https://github.com/moment/moment/issues/1754#issuecomment-221077737","issue_url":"https://api.github.com/repos/moment/moment/issues/1754","id":221077737,"user":{"login":"ericlau-solid","id":8011182,"avatar_url":"https://avatars.githubusercontent.com/u/8011182?v=3","gravatar_id":"","url":"https://api.github.com/users/ericlau-solid","html_url":"https://github.com/ericlau-solid","followers_url":"https://api.github.com/users/ericlau-solid/followers","following_url":"https://api.github.com/users/ericlau-solid/following{/other_user}","gists_url":"https://api.github.com/users/ericlau-solid/gists{/gist_id}","starred_url":"https://api.github.com/users/ericlau-solid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericlau-solid/subscriptions","organizations_url":"https://api.github.com/users/ericlau-solid/orgs","repos_url":"https://api.github.com/users/ericlau-solid/repos","events_url":"https://api.github.com/users/ericlau-solid/events{/privacy}","received_events_url":"https://api.github.com/users/ericlau-solid/received_events","type":"User","site_admin":false},"created_at":"2016-05-23T19:56:11Z","updated_at":"2016-05-23T19:56:11Z","body":"I second Drew's idea:\n\nimport \"moment/immutable\";\nstart = moment();\nend = start.add(10, 'minutes'); // immutable version of add\n\n\nThat would be great since it's immutable opt-out and no changes to\nfunction names.\n\n\nOn Mon, May 23, 2016 at 12:53 PM, Maggie Pint <notifications@github.com>\nwrote:\n\n> We have every intention of making the code side effect free. The basic\n> pattern would be to hook into the current functions, have them call clone,\n> and then operate on that clone.\n>\n> Technically though, if you're making truly immutable code, the objects\n> should be constructed with values that won't change. Doing so would\n> increase the difficulty in making this change though. It's much easier to\n> call clone and then do what we were doing before.\n>\n> —\n> You are receiving this because you commented.\n> Reply to this email directly or view it on GitHub\n> <https://github.com/moment/moment/issues/1754#issuecomment-221076796>\n>\n\n\n\n-- \n\nEric Lau from Gmail account.\n"}}
{"actor":{"display_login":"ericlau-solid"}}