modDate()
Modifies a Date
object with either offsets or specific times.
date
. The properties will be read and used to modify date
. For example to offset the year by 2 years into the future you can specify { year: 2 }
. To actually set a specific unit of time you can prefix the name of the property with $
. For example if this is { $day: 3, $month: 6 }
then the month will be set to July (because the month property of a Date
object is zero-based) and the day of the month will be set to 3
. Valid properties are year
(fullYear
), month
, day
(or date
), hour
, minute
, second
, or millisecond
(or ms
). You can also use the plural form of those property names. Additionally you can prefix those names with a $
to actually set the value instead of simply offsetting those values.date
that was passed but updated according to optOptions
.