Hacker News new | ask | show | jobs
by thornjm 824 days ago
Not sure if you already have this but something you could steal from the medical world is shortcuts to describe relative dates / time:

n+60 (is now + 60m)

n-10 (is 10m ago)

t+1 (is today + 1d)

w+2 (is two weeks from now)

m+12 (is 12 months from now)

2 comments

Our date picker already supports similar queries: 60m, 1d, 2w, 12mon. You can even combine them, like `2w+3d`.

(I skipped n-10 because it doesn't support picking dates in the past.)

Thanks for sharing, it's interesting to learn about the medical shorthand regardless :)

Wouldn't a "month" risk being many days off the intended target date, since it's a non-fixed timespan? E.g. how many days is "1 month from today" (March 20)? You mention medicine, so I assume there's something obvious I'm missing (then again, perhaps the constantly shifting dates for health care appointments where I live say otherwise ;D).
You just increment the month. March 20 m+1 is April 20.

If the date is invalid, like January 30 m+1 then you fallback to next valid date, February 28/29.

Well, that’s not “the month” at all, though. At least not something I’d use outside of getting a rough idea for setting the next meeting, and absolutely wouldn’t use in code (but it’s probably fine for a todo - I’m complicating things, sorry ;-))

Edit: but perhaps that’s the custom used at many places and I’m just not aware.

A few people/companies I've worked with avoid using the last few days of the month for "monthly" things.

For example, "every month on the 15th", "every month on the 1st", etc. It makes it easier to figure out compared to "every 30 days" or "every month on the 30th, unless there are less than 30 days in the month"

That sounds reasonable. I'm writing a dumb, little journal/todo CLI tool for personal use ("meet with @farmer @Monday @13:30 regarding #carrots"), and the library I used for time has a duration for most things except month (i.e. you can't do 2024-03-20 + 1_MONTH), which makes sense.