A RelativeDateShortcut is a special string that represents a shortcut to a date phrase that can be automatically mapped
to a
RelativeDateString
for use in widgets that leverage relative-dates, such as the
RelativeDateItem
.
Note that some shortcuts indicate a time period
but do not directly indicate whether the value refers to the start or end of the time period in question. This ambiguity
can be resolved by specifying an explicit RelativeDateRangePosition
when calling APIs
that convert from RelativeDates to absolute date values. This is the case for $today, $tomorrow,
$yesterday, $weekAgo, $weekFromNow, $monthAgo and $monthFromNow. If a range position
is not explicitly passed, these will all default to the start of the day in question.
Builtin options include
- $now - this moment
- $today - the current day. By default this resolves to the start of the current day
though an explicit
RelativeDateRangePosition
may be used to specify the end of the
current day. - $startOfToday - the start of today
- $endOfToday - the end of today (one millisecond
before the $startOfTomorrow)
- $yesterday - the previous day.
- $startOfYesterday - the start of
yesterday
- $endOfYesterday - the end of yesterday (one millisecond before the $startOfToday)
-
$tomorrow - the following day
- $startOfTomorrow - the start of tomorrow
- $endOfTomorrow - the end of
tomorrow
- $weekAgo - the current day of the previous week
- $weekFromNow - the current day of the
next week
- $startOfWeek - the start of the current week
- $endOfWeek - the end of the current week
- $monthAgo - the current day of the previous month
- $monthFromNow - the current day of the following
month
- $startOfMonth - the start of the current month
- $endOfMonth - the end of the current month
- $startOfYear - the start of the current year
- $endOfYear - the end of the current year