-
Notifications
You must be signed in to change notification settings - Fork 311
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
[JavaScript] Makes a pass on the implementation of DateTime.ToString
#3692
Comments
Python implementation of Fable/src/fable-library-py/fable_library/date.py Lines 450 to 454 in 88003be
Test suite to pass can be found here (make sure to check with current main version for an up to date list) Fable/tests/Python/TestDateTime.fs Lines 35 to 471 in cc06404
|
"R" would be a convenient one to support (rfc1123), useful for things like last-modified headers as it's one of the formats for rfc2616 http date formats: https://www.rfc-editor.org/rfc/rfc2616. Via fsi: > DateTime.Now.ToString("R");;
val it: string = "Sun, 15 Dec 2024 14:58:27 GMT" But fable currently fails with |
Working around this by grabbing the format from fsi: > System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat.RFC1123Pattern;;
val it: string = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'" and passing that to Note that I can't use the pattern directly as it's not implemented: |
I forgot to close this issue, the re-implementation of But it seems like I didn't implement all of the pre-defined format defined here:
This is expected, Fable does not support Globalization API. At best, we allow the API to be used in the code but it will not have any effect. I think in the past Fable emit warnings when encountering something like This was done so people can share more easily code between .NET and Fable runtime, without having to use a lot of compiler directives. |
Oups, I didn't understand what This is actually just a static string and don't really imply to support @joprice If we add support for |
Yes I only used the static string as a word around to find out a valid pattern that will work to pass to the date format function. If |
The current implementation of
DateTime.ToString
is incorrect for the javascript target.For example, it considers
T
andt
format to be the same thing when it isn't in .NET.Description
Related information
The text was updated successfully, but these errors were encountered: