Skip to content

[New Concept] Dates & Times#500

Merged
colinleach merged 4 commits into
exercism:mainfrom
colinleach:dates-times
Jun 5, 2026
Merged

[New Concept] Dates & Times#500
colinleach merged 4 commits into
exercism:mainfrom
colinleach:dates-times

Conversation

@colinleach

Copy link
Copy Markdown
Contributor

An incomplete draft at this stage. I learned a lot about the lubridate package while creating the Swift Scheduling and Meetup exercises, so I needed to write it down before I forgot everything.

@colinleach colinleach mentioned this pull request Apr 26, 2026
7 tasks
@colinleach

Copy link
Copy Markdown
Contributor Author

To pair with this, I assume we'll port booking-up-for-beauty from Julia. Not the greatest exercise, but I don't have anything better.

@colinleach

Copy link
Copy Markdown
Contributor Author

I've added an Intro, and updated About based on problems I ran into with booking-up-for-beauty. I'm going to mark it as ready for review, but I don't know if you prefer to wait until we finalize the exercise? It probably won't change much from now, maybe just small tweaks to the Intro.

@colinleach colinleach marked this pull request as ready for review May 30, 2026 23:11
@colinleach colinleach changed the title [New Concept] Dates & Times - draft [New Concept] Dates & Times May 31, 2026

@depial depial left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a hefty concept, but it's a complicated topic, so fully understandable. I've just made a few comments that came to mind while reading it, and pointed out some possible formatting issues.

I've only gone through the about.md, so if introduction.md differs in important ways, let me know and I'll pour over that too.

Comment thread concepts/dates-times/about.md Outdated
There are many ways to write dates and times, which tend to be culturally-specific.
All-number dates such as "7/6/23" are ambiguous, confusing, and have led to many expensive mistakes in multinational organizations (_the author says this from bitter personal experience_).

The international standard is defined in [`ISO 8601`][wiki-ISO8601], with two main advantages:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's implied above and below (and explicit in the link), but I still feel it could be nice to include y/m/d somewhere. Something as simple as:

The international standard (y/m/d) is defined in [ISO 8601][wiki-ISO8601], with two main advantages:

sec = 0,
tz = "UTC"
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, I assume there was output that was supposed to be shown: #> [1] "1970-01-01 00:00:00 UTC", but I think the example could be clearer as:

make_datetime(
  year = 2026L,
  month = 4L,
  day = 22L,
  hour = 17L,
  min = 0L,
  sec = 0,
  tz = "UTC"
)
#> [1] "2026-04-22 17:00:00 UTC"

make_datetime(2026, 4, 22, 17)
#> [1] "2026-04-22 17:00:00 UTC"

This is more parallel, but I'm not sure if there was a specific reason for the original difference in the inputs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused. The multi-line bit is a list of defaults, not an example intended to run.

@depial depial Jun 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that was my confusion, since I don't think I've seen that format before. I'm used to everything in a code block either being an input, an output or a comment. For that reason, if that code runs, we may want to consider showing the output (but I don't really mind either way).

Comment on lines +240 to +245
#> [1] Thu
Levels: Sun < Mon < Tue < Wed < Thu < Fri < Sat
wday(d, label = TRUE, abbr = FALSE)
#> [1] Thursday
Levels: Sunday < Monday < Tuesday < Wednesday < Thursday < Friday < Saturday
```

@depial depial Jun 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should Levels: Sun < Mon < Tue < Wed < Thu < Fri < Sat and Levels: Sunday < Monday < Tuesday < Wednesday < Thursday < Friday < Saturday be prepended with a # or #> [] here?

Comment thread concepts/dates-times/about.md Outdated

### Periods

A `period`, such as `hours(3)`, just changes the clock time by adding 3 hours.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to avoid the word adding (even thought it's technically correct), I think I'd prefer:

A period, such as hours(3), can be used to increment a clock time by 3 hours.

Comment thread concepts/dates-times/about.md Outdated

### Durations

A `duration`, such as `dhours(3)`, advances physical time by 3 hours, respecting irregularities such as DST that cause clock time to deviate from physical time.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, maybe just replace advances with increments?

Comment thread concepts/dates-times/about.md Outdated

# same clocktime, different tz
local - AZ
Time difference of -7 hours

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this output? (I'm not doing this locally, so I'm unsure what the output looks like)

@@ -0,0 +1,5 @@
{
"authors": ["colinleach"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the linter might want:

{
  "authors": [
    "colinleach"
  ],

@colinleach

Copy link
Copy Markdown
Contributor Author

I've only gone through the about.md

I can't even remember what state the intro is in. We'll probably change it in any case, during review of booking-up-for-beauty.

@colinleach

Copy link
Copy Markdown
Contributor Author

I've taken these comments and applied them to booking-up-for-beauty. I'll wait for that to be agreed and merged before changing this concept.

@colinleach

Copy link
Copy Markdown
Contributor Author

I copied the Intro as-is from booking-up-for-beauty, then manually made the same changes in the About. I'll merge, as my last act before walking away from the computer for today.

@colinleach colinleach merged commit 36d9e45 into exercism:main Jun 5, 2026
2 checks passed
@colinleach

Copy link
Copy Markdown
Contributor Author

Seems OK on the website. Floating, of course (like the regex concept), because functional-programming is a missing prereq.

@colinleach colinleach deleted the dates-times branch June 6, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants