-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Explicitly label unix timestamp as a number #529
Conversation
I missed "prevent errors, you should cast the numeric type of the time to UTCTimestamp" when reading this initally. This extra comment may help future library users avoid accidentally cast timestamp as a string and open new issues.
I'm afraid that they shouldn't be UTC actually. It's preferred to provide them in UTC, but to emulate "timezones", you might to pass date with offset (we'll provide examples/docs for that in #497). Thus, I think that it's better to write about that in a fix for that issue to avoid confusing and more misunderstanding. |
I mean, the nature of timestamp is UTC-based by-default (it's number of seconds since |
I apologize if the intention of the commit was unclear, I had an issue with the error message stating "string format must be in yyyy-mm-dd format" when a Unix timestamp is passed as a string. I spent an extra 20 minutes looking through the docs to see if there was a configuration setting that had to be passed to accept Unix based timestamps. It was not until I found issue #414. Before I found my stupid mistake. I agree that it is a mistake on my end because epoch timestamps should not be stored as strings. Unfortunately the error provided by the library made it difficult for me to understand what specifically was incorrect. I thought that by adding the one line to the documentation it would a good hint for library users in the future to quickly check their data type first. I understand your concerns with the thank you for the reference to the other issue as it is something that I have not considered either. As well thanks for maintaining this great library :) |
I guess we'll help solve such issues faster in #315. But probably we should say that it should be number - 123 (not string-like-number value
Agree. Do you have full error message you got here? I thought that we log passed date value as well in the message?
Yes, sure! But I think that it shouldn't be about whether that value should be UTC or not, that note should be about type of the value IMO (string vs number). |
I completely agree, I think that makes the most sense. I attempted to copy the format from Business day object and just missed the mark.
you are correct, the issue is simply user error and I have already put way more thought into it than its worth. If this issue happens frequently maybe adding a second condition Although after looking at the code and running the example it seems pointless to cover an edge case that the new Date constructor does not even handle. Cheers, sorry for taking up your time. |
Not sure what exactly condition we need to add there, because But I think it's a good direction to handle it in #315 anyway, thanks! |
I missed "prevent errors, you should cast the numeric type of the time to UTCTimestamp" when reading this initally. This extra comment may help future library users avoid accidentally cast timestamp as a string and open new issues.
Type of PR:
PR checklist:
Overview of change:
Is there anything you'd like reviewers to focus on?