-
Notifications
You must be signed in to change notification settings - Fork 115
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
Fix date literals #532
Fix date literals #532
Conversation
Hello, thanks for your interest. I'm not sure what behaviour you are trying to change exactly. Could you provide an example of Haskell code that does not work before but that does work after? |
Hello :) Please have a look at the "padded" family of tests. Those tests fail without the change to date formatting with the same error as the one below:
It seems PostregreSQL doesn't seem to know how to parse "20-10-20T22:36:00Z", because both "YY-MM-DD" and "DD-MM-YY" could be valid. |
Ah, I see. > formatTime defaultTimeLocale "%F" (fromGregorian 1 2 3)
"1-02-03"
> formatTime defaultTimeLocale "%0Y-%m-%d" (fromGregorian 1 2 3)
"0001-02-03"
> iso8601Show (fromGregorian 1 2 3)
"0001-02-03" For you to do please @kozak:
|
I removed the usage of |
See #532 (comment) Thanks to @kozak
Thanks very much for spotting and fixing this! Pushed to (That commit is Postgres only. Do you really want this for SQLite too?) |
Thanks @tomjaguarpaw :) Nope we can ignore SQLite. |
Cool, thanks for your help on this! |
Reason why this is needed: Postgresql doesn't know how to parse:
25-10-20T22:36:00Z
because bothd-m-y
andy-m-d
formats could work.Will add explicit padding to
year
to make it clear.The previous format
%F
is%Y-%m-%d
where%Y
is unpadded.The behaviour is illustrated below:
For SQLite, the
datetime
function producesNULL
for the non-padded versions.