-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
Handle date and timestamp objects more gracefully #343
Comments
@vatsan28 wanted to take this on.. @chrismclarke are you already working on it? |
I think this warrants discussion, so if @vatsan28 wants to take a look and make a proposal we can determine how best to implement. |
Talking about a possible approach with Chris on slack. |
(my comment from discussion) to be honest it's a bit of a pain issue and I'm waiting to see if anyone in the firebase community comes up with a solution, rather than trying to hack something together. it's why I intentionally didn't add a |
I looked at the code to identify where we use date time attributes other than the defaults
This is the current state. Can you guys confirm if i missed any other attribute in any other model? I don't think i have access to the firebase console to check. For a future state, i tried replicating this on my small learning project. I used a simple epoch to readable date conversion. So we could add a similar method to the Thoughts? @chrismclarke |
I think for this type of thing it might be better to put in a |
Any updates on this ? |
I recently added two methods to handle dates in the |
I think for now we just keep using these methods and make clear in typings what data formats are in use are sufficient. I expect this to be a non-issue in future versioning where we provide alternate database options. Firestore look set to not budge on the issue (they will keep converting any dates sent to timestamps and return the data in timestamps), so closing |
I think it's time to re-open this as we're now starting to deal with other databases (not just) firestore which could easily add confusion. I suggest we plan to change all dates to ISOStrings represent date as YYYY-MM-DDTHH:mm:ss.sssZ , and so not only are standardised across timezones and provide ms precision to help avoid duplicate data, but should also support querying (e.g. get data where This should be fairly straightforward to do, using find/replace to change Timestamp to string format (or possibly better to create a type |
OK, this is a pain point on something else I'm working on so plan to create a PR to migrate all the backend functionality and existing data |
By default whenever firestore saves a date object it converts to a timestamp to support nanoseconds for use in queries (recent behaviour change). Either want to update interfaces to acknowledge this is the data format, find a way to disable this behaviour, or add a conversion for required fields on data return.
The text was updated successfully, but these errors were encountered: