-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Format created of transaction with date time value if the created date is the current date #34784
Merged
Merged
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d3998d4
format created of transaction with date time value if the created dat…
dukenv0307 030d802
implement util function for get current date of money request
dukenv0307 1e0bb54
add return type explicitly
dukenv0307 56b9b5b
Merge branch 'main' into fix/33814
dukenv0307 ac00d37
Merge branch 'main' into fix/33814
dukenv0307 120c9ce
convert to the same timezone before compare
dukenv0307 e7642f6
refactor compare date logic
dukenv0307 4908662
merge main and edit comment
dukenv0307 6e49257
edit the original comment
dukenv0307 8e7dc14
Merge branch 'main' into fix/33814
dukenv0307 b25f0c7
merge main
dukenv0307 e3472ec
Merge branch 'main' into fix/33814
dukenv0307 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I won't happily approve more smelly approaches to date operations. Let's stick with the best thing we got, using
date-fns
as much as possible.You'll have to convince me why that's not the good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cubuspl42 We already have
formatWithUTCTimeZone
function and this function usedate-fns-tz
lib as well so I think it's good to use this function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getDBTime
creates aDate
, converts it to string, screws up the ISO format, then we pass it toformatWithUTCTimeZone
, which again parses the string toDate
, dumps it to string, and then we compare it.It's a nightmare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is this even correct? Aren't we ultimately forced to use the "DB time" format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So timezone we should use. the current user timezone or UTC timezone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid the
created
string invalid date we can useisValid
function ofdate-fns
as wellThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okey, let's try...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cubuspl42 I tested and updated this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Time zones are the worst. Just to clarify, all datetimes that get saved to our back end should be stored as UTC strings in the
YYYY-MM-DD HH:MM:SS
format. But the kicker is that when displaying them back to the user, we probably need to show it relative to their time zone.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timezones are the worst, true, but we're not helping ourselves by making very questionable decisions like passing dates around as strings, converting
Date
s to string toDate
s to strings toDate
..., not using separate types for instants and dates and datetimes, etc., etc.