{"action":"created","issue":{"url":"https://api.github.com/repos/moment/luxon/issues/291","repository_url":"https://api.github.com/repos/moment/luxon","labels_url":"https://api.github.com/repos/moment/luxon/issues/291/labels{/name}","comments_url":"https://api.github.com/repos/moment/luxon/issues/291/comments","events_url":"https://api.github.com/repos/moment/luxon/issues/291/events","html_url":"https://github.com/moment/luxon/issues/291","id":340080212,"node_id":"MDU6SXNzdWUzNDAwODAyMTI=","number":291,"title":"Number `Infinity` not supported","user":{"login":"cooperka","id":2047062,"node_id":"MDQ6VXNlcjIwNDcwNjI=","avatar_url":"https://avatars2.githubusercontent.com/u/2047062?v=4","gravatar_id":"","url":"https://api.github.com/users/cooperka","html_url":"https://github.com/cooperka","followers_url":"https://api.github.com/users/cooperka/followers","following_url":"https://api.github.com/users/cooperka/following{/other_user}","gists_url":"https://api.github.com/users/cooperka/gists{/gist_id}","starred_url":"https://api.github.com/users/cooperka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cooperka/subscriptions","organizations_url":"https://api.github.com/users/cooperka/orgs","repos_url":"https://api.github.com/users/cooperka/repos","events_url":"https://api.github.com/users/cooperka/events{/privacy}","received_events_url":"https://api.github.com/users/cooperka/received_events","type":"User","site_admin":false},"labels":[{"id":293349090,"node_id":"MDU6TGFiZWwyOTMzNDkwOTA=","url":"https://api.github.com/repos/moment/luxon/labels/issue:%20enhancement","name":"issue: enhancement","color":"84b6eb","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-11T03:38:08Z","updated_at":"2018-07-12T13:52:04Z","closed_at":null,"author_association":"NONE","body":"I came across this issue trying to invoke `DateTime.fromMillis(updatedAt).plus(duration.CACHE_TTL)`, a simple way of calculating whether cached data is stale or not. I can set `CACHE_TTL` to `Infinity` during dev to prevent the cache from expiring. Unfortunately Luxon doesn't support this, even though technically `typeof Infinity === 'number'`.\r\n\r\nSo far I've tracked it down to the implementation of [`fromMillis`](https://github.com/moment/luxon/blob/master@{2018-07-09}/src/duration.js#L217) which is called by [`friendlyDuration`](https://github.com/moment/luxon/blob/master@{2018-07-09}/src/duration.js#L155), but I ran out of time to debug. I'll attempt to continue in a few days.\r\n\r\nHappy to submit a PR, though I'm not sure what the consequences of supporting this number would be -- is there such thing as an \"infinite\" future, or do we have to pick some date arbitrarily far away?"},"comment":{"url":"https://api.github.com/repos/moment/luxon/issues/comments/404519345","html_url":"https://github.com/moment/luxon/issues/291#issuecomment-404519345","issue_url":"https://api.github.com/repos/moment/luxon/issues/291","id":404519345,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDUxOTM0NQ==","user":{"login":"gampleman","id":69144,"node_id":"MDQ6VXNlcjY5MTQ0","avatar_url":"https://avatars1.githubusercontent.com/u/69144?v=4","gravatar_id":"","url":"https://api.github.com/users/gampleman","html_url":"https://github.com/gampleman","followers_url":"https://api.github.com/users/gampleman/followers","following_url":"https://api.github.com/users/gampleman/following{/other_user}","gists_url":"https://api.github.com/users/gampleman/gists{/gist_id}","starred_url":"https://api.github.com/users/gampleman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gampleman/subscriptions","organizations_url":"https://api.github.com/users/gampleman/orgs","repos_url":"https://api.github.com/users/gampleman/repos","events_url":"https://api.github.com/users/gampleman/events{/privacy}","received_events_url":"https://api.github.com/users/gampleman/received_events","type":"User","site_admin":false},"created_at":"2018-07-12T13:52:04Z","updated_at":"2018-07-12T13:52:04Z","author_association":"NONE","body":"It seems from some of my testing that Luxon supports smaller dates than the native date. It would be nice to have some constants that support maximum and minimum safe dates. For example if one wants to (de)serialize dates to ISO format, than it seems like the maximum safe date is `DateTime.fromMillis(253402300799999)`.\r\n\r\n<details>\r\n  <summary>I obtained this number with this binary search</summary>\r\n\r\n```javascript\r\nfunction binarySearch(min, max, cond) {\r\n  const midPoint = Math.floor((max - min) / 2);\r\n  if (min === midPoint) {\r\n    return midPoint;\r\n  } \r\n  if (cond(midPoint)) {\r\n    return binarySearch(midPoint, max, cond);\r\n  } else {\r\n    return binarySearch(min, midPoint, cond);\r\n  }\r\n}\r\n\r\nbinarySearch(0, 8640000000000000, ms => DateTime.fromISO(DateTime.fromMillis(ms).toISO()).isValid)\r\n```\r\n\r\n</details>"}}
{"actor":{"display_login":"gampleman"}}