Skip to content

This site describes solve-engine 2.44.0, the version npm installs.

Relative dates

Package: DATETIME_PACKAGE. Registered by createEngine(); for a slimmer engine, register it explicitly (see choosing packages).

A relative date names a day by its relation to today rather than by its calendar number, the way you would say tomorrow or next friday out loud. Each resolves against the current date. The answers on this page are worked out for one fixed moment, noon on Wednesday 11 March 2026 in London, so that they can be checked; the notepad under each example works them out for your own today.

now // Wednesday, March 11, 2026, 12:00:00 PM
today // Wednesday, March 11, 2026
tomorrow // Thursday, March 12, 2026
yesterday // Tuesday, March 10, 2026
next friday // Friday, March 13, 2026
last monday // Monday, March 9, 2026

A few of these read differently from how they are often said, so each is set out here, against the same fixed moment.

today is a day, not the current instant. today, tomorrow and yesterday name a day, anchored at local midnight, so each shows as a date with no time of day. now is the current instant, with its time of day. A count of days from today is a whole number: at noon, days until 25 december is 289 days rather than 288.50. An app can keep the time of day on these instead, as counting from the start of the day sets out.

now // Wednesday, March 11, 2026, 12:00:00 PM
today // Wednesday, March 11, 2026
days until 25 december // 289 days
3 days from today // Saturday, March 14, 2026
3 days before today // Sunday, March 8, 2026

next and last step over today. next friday is the first Friday after today and last friday the most recent one before it, so either one said on a Friday is a week away rather than today. On Wednesday 11 March, next friday is the 13th and last friday the 6th, and next saturday is the 14th, the day after that Friday.

next friday // Friday, March 13, 2026
last friday // Friday, March 6, 2026
next saturday // Saturday, March 14, 2026

A length of time followed by ago counts back from now. A span of a day or more counts back from today, the way 3 days before today does, so it is a date. A shorter span counts back from the clock, so it keeps the time of day. Any length of time works, from minutes to years.

3 days ago // Sunday, March 8, 2026
2 hours ago // Wednesday, March 11, 2026, 10:00:00 AM
1 year ago // Tuesday, March 11, 2025

ago is read this way only straight after a length of time. Anywhere else it is an ordinary word, so a note that says 3 days ago I paid is left as text, and a variable called ago still works.

next week, this month, last week and last year name a whole week, month or year, and each stands for its first day: next month is the first of next month, and next week is next Monday. A week runs Monday to Sunday unless the host starts it on another day, or the engine’s locale names a region whose week does (see working days).

next week // Monday, March 16, 2026
this week // Monday, March 9, 2026
last week // Monday, March 2, 2026
next month // Wednesday, April 1, 2026
next year // Friday, January 1, 2027
last year // Wednesday, January 1, 2025

start of and end of pick the first or last day of a week, month or year, the current one or a named one. beginning of is start of. The answer is the day itself, at the start of it, so end of month is the 31st rather than the last minute of it.

start of month // Sunday, March 1, 2026
end of month // Tuesday, March 31, 2026
end of next month // Thursday, April 30, 2026
end of week // Sunday, March 15, 2026
start of year // Thursday, January 1, 2026
end of last year // Wednesday, December 31, 2025

Each is an ordinary date, so it moves by a length of time and counts down like any other:

end of month + 1 day // Wednesday, April 1, 2026
next week + 2 days // Wednesday, March 18, 2026

start and end are claimed only before of and a period, so they stay free as names: start = 5 and end - start work as they always have.

this friday is the coming Friday: later this week, or today when today is a Friday. That is the difference from next friday, which always steps over today. Like next friday, it is a date with no time of day.

this friday // Friday, March 13, 2026
this wednesday // Wednesday, March 11, 2026
next wednesday // Wednesday, March 18, 2026

A day of the week on its own inside a sum, or after days until, reads as this friday does:

friday + 1 week // Friday, March 20, 2026
days until friday // 2 days

A day of the week alone on a line is not read as a date. Notes head a day with its name (Friday, then the day’s lines under it), and that heading should stay text, so a line that is only a weekday is refused with a message suggesting this friday or next friday. A heading with a colon, Friday: 3 hours, is unaffected: the part after the colon is the line.

A note that plans by the day means a date, not a moment, when it says tomorrow: today + 3 weeks is a deadline, and the minute the line was typed would be noise on it. So the engine reads a relative day as a date, anchored at local midnight. An app that wants the time of day kept can choose that reading with one setting, date.relativeDays. It takes two values:

  • "midnight", the default: each relative day starts at midnight, so it is a date with no time of day, and a count of days from today is a whole number.
  • "now": each relative day is the current instant moved by whole days, with the time of day, as every version before 2.44.0 read them.
createEngine({ config: { date: { relativeDays: "now" } } });

The same lines at the same moment, noon on Wednesday 11 March 2026, under each:

line"midnight" (the default)"now"
todayWednesday, March 11, 2026Wednesday, March 11, 2026, 12:00:00 PM
tomorrowThursday, March 12, 2026Thursday, March 12, 2026, 12:00:00 PM
next fridayFriday, March 13, 2026Friday, March 13, 2026, 12:00:00 PM
3 days agoSunday, March 8, 2026Sunday, March 8, 2026, 12:00:00 PM
today + 3 weeksWednesday, April 1, 2026Wednesday, April 1, 2026, 12:00:00 PM
days until 25 december289 days288.50 days
tomorrow - today1 day24:00
nowWednesday, March 11, 2026, 12:00:00 PMWednesday, March 11, 2026, 12:00:00 PM
2 hours agoWednesday, March 11, 2026, 10:00:00 AMWednesday, March 11, 2026, 10:00:00 AM

Under "midnight" the setting reaches today, tomorrow and yesterday, next and last with a weekday, this friday and a bare weekday in a sum, a span of a day or more followed by ago, and the count in days until and days since (and in weeks, months or years). Two days subtract to a count of days, as two written dates do, rather than to hours on a clock.

The boundary, and why: now is the current instant under both settings, and so is a span shorter than a day (2 hours ago, hours until 5pm), because those are questions about the clock. A time added to the start of the day is a time on it, so today + 2 hours is 2:00 AM; write now + 2 hours for two hours from now. next week, end of month and the other whole periods already name a day, so they read the same under both.

The start of the day is the zone’s own. On a day whose midnight the zone skips (Santiago springs forward at 00:00, so 6 September 2026 begins at 01:00) the day still shows as a date, and a whole number of days from it lands on the start of the day reached.

Some natural spellings are still not read, and a line that uses one is refused rather than guessed at. Each has a spelling that works:

Not readWrite instead
in 3 days3 days from today
a week ago1 week ago
the day after tomorrowtomorrow + 1 day
Monday next weeknext week, which is its Monday
tomorrow at noontomorrow and a clock time on separate lines
next weekendnext saturday
end of quarterend of month on the quarter’s last month

The week starts on Monday unless the host or the locale’s region says otherwise. A date so far away that no calendar holds it, past AD 275760 or before 271821 BC, is refused rather than shown: 99999999999 days ago is an error, not a date.