$date
Updated on Aug 21, 2025 7 minutes to readThe Date Plugin provides a unified interface to validate, manipulate, and compare dates.
Methods
| Method | Description | 
|---|---|
| addDays | Adds days to the given date. | 
| addMonths | Adds months to the given date. | 
| addQuarters | Adds quarters to the given date. | 
| addWeeks | Adds weeks to the given date. | 
| addYears | Adds years to the given date. | 
| current | Retrieves the current date. | 
| day | Gets or sets the day of the given date. | 
| diff | Calculates the difference between two dates. | 
| endOfMonth | Returns the last day of the month. | 
| endOfQuarter | Returns the last day of the quarter. | 
| endOfWeek | Returns the last day of the week. | 
| endOfYear | Returns the last day of the year. | 
| isValid | Checks if the given value is a valid date. | 
| month | Gets or sets the month of the given date. | 
| startOfMonth | Returns the first day of the month. | 
| startOfQuarter | Returns the first day of the quarter. | 
| startOfWeek | Returns the first day of the week. | 
| startOfYear | Returns the first day of the year. | 
| year | Gets or sets the year of the given date. | 
Methods Details
addDays()
• Type
(value: E8Date, days: number) => E8Date• Details
addMonths()
• Type
(value: E8Date, months: number) => E8Date• Details
addQuarters()
• Type
(value: E8Date, quarters: number) => E8Date• Details
addWeeks()
• Type
(value: E8Date, weeks: number) => E8Date• Details
addYears()
• Type
(value: E8Date, years: number) => E8Date• Details
current()
• Type
() => E8Date• Details
Returns the current E8Date.
day()
• Type
/** Gets the day of the given date. */
(value: E8Date) => number;
/** Sets the day of the given date. */
(value: E8Date, days: number) => E8Date;• Details
Expects an E8Date, and optionally a number of days to set.
Returns a number when called without the second argument; otherwise it returns an updated E8Date.
diff()
• Type
(
    value1: E8Date, 
    value2: E8Date, 
    unit?: DateUnit, 
    precise?: boolean
) => number• Details
Expects two E8Date values, an optional DateUnit (default: 'day'), and an optional precision flag (default: false).
Returns a number representing the difference between the two dates in the specified unit (fractional when precise is true).
endOfMonth()
• Type
(value: E8Date) => E8Date• Details
endOfQuarter()
• Type
(value: E8Date) => E8Date• Details
endOfWeek()
• Type
(value: E8Date) => E8Date• Details
endOfYear()
• Type
(value: E8Date) => E8Date• Details
isValid()
• Type
(value: any) => boolean• Details
Expects any value.
Returns a boolean indicating whether the value represents a valid date.
month()
• Type
/** Gets the month of the given date. */
(value: E8Date) => number;
/** Sets the month of the given date. */
(value: E8Date, months: number) => E8Date• Details
Expects an E8Date, and optionally a number of months to set.
Returns a number when called without the second argument; otherwise it returns an updated E8Date.
startOfMonth()
• Type
(value: E8Date) => E8Date• Details
startOfQuarter()
• Type
(value: E8Date) => E8Date• Details
startOfWeek()
• Type
(value: E8Date) => E8Date• Details
startOfYear()
• Type
(value: E8Date) => E8Date• Details
year()
• Type
/** Gets the year of the given date. */
(value: E8Date) => number;
/** Sets the year of the given date. */
(value: E8Date, years: number) => E8Date• Details