You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RFC 3339 does not specify the number of digits for the fractional second portion but a common practice is to use three digits so the fractional second portion relates to whole milliseconds:
yyyy-MM-dd'T'HH:mm:ss.fffK (or yyyy-MM-dd'T'HH:mm:ss.fffZ in NF since 'K' isn't supported and all DateTime are assumed to be UTC)
Ex: 2024-05-15T04:20:05.069Z
Unfortunately the DateTime.Parse implementation in NF is currently only supporting the ISO 8601 "round trip time" format which requires that the fractional second portion contain 7 digits (yyyy-MM-ddTHH:mm:ss.fffffff) code.
This causes the example string above to parse with '0' milliseconds and '69' "extra" ticks. The issue is here because the code assumes the string represents a 7 digit number '0000069' when the correct 7 digit number is '0690000'
nfbot
changed the title
DateTime.Parse does not handle string that conform to RFC 3339.DateTime.Parse does not handle string that conform to RFC 3339
May 15, 2024
Library/API/IoT binding
nanoFramework.CoreLibrary
Visual Studio version
No response
.NET nanoFramework extension version
No response
Target name(s)
No response
Firmware version
No response
Device capabilities
No response
Description
RFC 3339 does not specify the number of digits for the fractional second portion but a common practice is to use three digits so the fractional second portion relates to whole milliseconds:
yyyy-MM-dd'T'HH:mm:ss.fffK
(oryyyy-MM-dd'T'HH:mm:ss.fffZ
in NF since 'K' isn't supported and allDateTime
are assumed to be UTC)Ex:
2024-05-15T04:20:05.069Z
Unfortunately the
DateTime.Parse
implementation in NF is currently only supporting the ISO 8601 "round trip time" format which requires that the fractional second portion contain 7 digits (yyyy-MM-ddTHH:mm:ss.fffffff
) code.This causes the example string above to parse with '0' milliseconds and '69' "extra" ticks. The issue is here because the code assumes the string represents a 7 digit number '0000069' when the correct 7 digit number is '0690000'
How to reproduce
See sample code below.
Expected behaviour
No response
Screenshots
No response
Sample project or code
Output:
Aditional information
I looked at the code a bit and I don't have a good solution at the moment.
The text was updated successfully, but these errors were encountered: