hs-hourglass icon indicating copy to clipboard operation
hs-hourglass copied to clipboard

`timeParse` for ISO8601_DateTime does not parse nanoseconds

Open abailly opened this issue 8 years ago • 1 comments

According to ISO8601 specification, it is possible to represent fractions of a second (or the smallest represented unit) using a decimal sign (either period or comma...). This is not taken into account into the TimeFormat:

> d <- generate (arbitrary :: Gen DateTime)
> d
DateTime {dtDate = Date {dateYear = 2094, dateMonth = September, dateDay = 26}, dtTime = TimeOfDay {todHour = 19h, todMin = 27m, todSec = 17s, todNSec = 8500601ns}}
> timePrint ISO8601_DateAndTime d
"2094-09-26T19:27:17+00:00"

abailly avatar Feb 07 '17 14:02 abailly

possible doesn't mean it is necessary wanted at all time to print (or parse), so this particular formatter/parser doesn't print/parse nanoseconds, but you can make one that does very easily for example (roughly): "YYYY-MM-DD H:MI:S.p6 TZHM".

hourglass could export one defined as ISO8601_DateAndTimeP, PR welcome.

vincenthz avatar Feb 08 '17 11:02 vincenthz