Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature Request: as.ISO8601 #629
Comments
|
We should name it something else I guess. There is no class ISO8601, so |
|
For a name, For the For |
This can work but the drawback is that you cannot add methods to classes which you don't own (like difftime). Maybe
Nope. There are two core date-time classes - Date and POSIX. The final implementation should consider the parser - it should allow for the round trip. Currently not everything in ISO8601 is supported and implementing all those ISO tweaks and tricks is, quite frankly, out of scope.
With small effort anyone can write their own formatter with |
|
I like
Perfectly fair. If I find myself needing something more esoteric, I may write an ISO8601 library. For now, I'm happier with it living in lubridate. I'll just keep the |
|
Maybe |
|
|
|
I wrote this feature tonight. A few differences relative to our conversation above:
|
as.ISO8601methods would be useful for all the date, date/time, period, duration, and interval functions.To make this as useful as possible, I think it would benefit to not use
as.characterand make a newas.ISO8601generic function with arguments:x: The object to convertformat: This would depend on what is being represented:include_tz: ifNULL(default), include/exclude the time zone from the date/time based on the input data. IfFALSE, exclude the time zone from the representation, and ifTRUEinclude the time zone in the representation. (It would be ignored if time zone does not apply to the output format.)repeat: (default:NULL) For intervals, repeating could be specified by setting to a non-NULL, positive integer orInffor indefinite, future repeats.repeat_start: (default:NULL) For intervals, repeat start date/time. (Must be a date, time, or date/time object type.)(As initially discussed in #362)