-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Notification.timestamp to be an unrestricted double instead #56
Conversation
Paging @domenic as this relates closely to whatwg/webidl#2. The primary question I have is what we expect NaN and infinity to do. Also, we'd want this to be compatible with timestamps in other specs, but this is quite a mess right now.
The Web Animation API defines the behavior for NaN, so we could map that to the current time? |
Date.now() returns a value of the Number type, which maps to WebIDL's unrestricted double. This allows timestamps in the entire range of Date to be used, rather than just times after the unix epoch.
8459a05
to
2affd49
Compare
I tried to give some guidance in this regard at https://w3ctag.github.io/design-principles/#times-and-dates. In general I think all of these cases should be using We might need to change the definition or behavior of those two types though, since right now they do not account for the cases you mention. /cc @heycam I see four options for NaN/+Infinity/-Infinity:
I don't have a strong opinion between these and would rather let people who do make the decision. But I do feel strongly that everyone should converge on DOMTimeStamp and DOMHighResTimeStamp, so we can just update definitions in one place and not have to deal with this every time. Maybe after we get this straightened out someone can go on a pull request spree across all the repos you mention. |
Yeah, if we want Not sure I have a strong opinion on what to do with these values either, although I'm not particularly sold on NaN == current time. |
The inconsistency here seems not great, at the very least. (DOMTimeStamp turns them into zero, DOMHighResTimestamp throws.) |
I see. But, this is just an artificial restriction imposed by its definition. We should fix it, at the same time as we decide how to handle NaN and the infinities. |
@beverloo any thoughts? |
Fixed by #60. |
Date.now() returns a value of the Number type, which maps to WebIDL's
unrestricted double. This allows timestamps in the entire range of
Date to be used, rather than just times after the unix epoch.