-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
ISO8601 compatibility for DateTime ToString #158
Conversation
Hi @networkfusion, I'm nanoFramework bot. A human will be reviewing it shortly. 😉 |
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.
It would be great if you could update the DateTime unit tests to cover this change.
nanoFramework.CoreLibrary/System/Globalization/DateTimeFormatInfo.cs
Outdated
Show resolved
Hide resolved
nanoFramework.CoreLibrary/System/Globalization/DateTimeFormatInfo.cs
Outdated
Show resolved
Hide resolved
nanoFramework.CoreLibrary/System/Globalization/DateTimeFormat.cs
Outdated
Show resolved
Hide resolved
It is already there, but broken...
|
Can you give it a try and fix whatever is not working there? Only for the string formats that we support, of course. 😁 |
to be nF compatible
remove format precision.
Assuming the test I have uncommented and updated is reasonable... All tests now pass! |
Allows manual verification.
The standard doesn't specify any size for the fractional part. It mentions that it should be agreed between parties. Seems that the 3 places comes from from MS SQL formats (and the fact .NETMF was a lightweight platform). |
Regarding the Unit Test: well... that's the bare minimum there... the call could return It should be improved to do a proper comparison and validate the expected outcome. |
- MaxSecondsFractionDigits is now in sync with .NET. - Rework code that handles 'f' format token. - Adjust GetRealFormat for O and o to follow .NET. - Change visibility of DateTime.TicksPerMillisecond to allow using it from DateTimeFormat. - Add UnitTest to properly validate output from 'O' and 'o' specifiers. - Rework code for GetRandomDateTime in DateTime Units Tests to generate full ticks value.
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.
Should be OK now, fully compliant with .NET and properly tested.
Description
Adds
DateTime.ToString("o");
so that ISO8601 compatible datetimes can be generated.Workarounds from the full framework are:
Z
instead of the datetime Culture specifierK
as (I dont think) we support it.Motivation and Context
Option was missing.
How Has This Been Tested?
Screenshots
Types of changes
Checklist: