-
Notifications
You must be signed in to change notification settings - Fork 1
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
ISO 8601 week date edge cases #50
Comments
Thank you again for another thoughtful write-up! The weekday parsing is definitely underdeveloped. It leans primarily on Before jumping into changes, I'm curious - do you have a use case where yearweeks are frequently used? BugsJust to itemize the things that this brought to my attention:
BehaviorsJust using this example that you gave for discussion: parttime::as.parttime("2009-W02") # although day is unknown year-month is definitely 2009-01
## Warning in warn_repr_data_loss(x, includes = "week", excludes = "weekday") :
## Date strings including week and excluding weekday can not be fully
## represented. To avoid loss of datetime resolution, such partial dates
## are best represented as timespans. See `?timespan`.
## <partial_time<YMDhms+tz>[1]>
## [1] "2009" Parsing to Since I wasn't aware of many use cases for this behavior, trying to be exhaustive here wasn't prioritized. |
Although I have my Google calendar set to also show the ISO week number and I use ISO week dates in my bullet journal I don't have a use case where I need to parse them in R. If I did need to parse them I can first parse them with library(datetimeoffset)
library(parttime)
as_datetimeoffset("2009-W53-7") |> as.parttime()
<partial_time<YMDhms+tz>[1]>
[1] "2010-01-03" as_datetimeoffset("2009-W01-1") |> as.parttime()
<partial_time<YMDhms+tz>[1]>
[1] "2008-12-29" as_datetimeoffset("2009-W01") |> as.parttime()
<partial_time<YMDhms+tz>[1]>
[1] NA as_datetimeoffset("2009-W02") |> as.parttime()
<partial_time<YMDhms+tz>[1]>
[1] "2009-01" |
I'm not sure how important the ISO week date parsing is but I'm observing what I suspect are bugs when the ISO week date "year" is different from the Gregorian date "year" when parsing ISO week dates
The text was updated successfully, but these errors were encountered: