ISO 8601 week date edge cases
- Dominant language
- R
- Stars
- 18
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
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
```r
parttime::as.parttime("2009-W53-7") # 2010-01-03
```
```r
Warning in strptime(paste(x[, "year"], x[, "week"], x[, "weekday"] - 1L, :
(0-based) yday 373 in year 2009 is invalid
[1]>
[1] "2009"
```
```r
parttime::as.parttime("2009-W01-1") # 2008-12-29
```
```r
[1]>
[1] "2009-01-04"
```
```r
clock::iso_year_week_day(2009, 1, 1) |> as_year_month_day()
```
```r
[1]>
[1] "2008-12-29"
```
```r
parttime::as.parttime("2009-W02") # although day is unknown year-month is definitely 2009-01
```
```r
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`.
[1]>
[1] "2009"
```
```r
parttime::as.parttime("2009-W01") # unknown year since includes days in 2008 and 2009
```
```r
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`.
[1]>
[1] "2009"
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the as.parttime() entry point and reproduce the four ISO week-date examples in the issue, comparing the results with clock::iso_year_week_day(). Check the handling of week-year boundaries and incomplete week dates; done means full dates map to the correct Gregorian dates and partial dates preserve the appropriate uncertainty without incorrect year values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100