modDate()

Modifies a Date object with either offsets or specific times.

This function is valid in v2.16.0 to v2.18.1. This function has been downloaded 13 times.

Parameters

{Date} date
The date to be modified.
{Object} objOptions
The object which specifies how to modify 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.

Returns

{Date}
The same date that was passed but updated according to optOptions.