Skip to main content

RQBDateTimeLibraryAPI

Defined in: types.ts:107

Properties

add

add: (d: DateOrString, amount: number, unit: RelativeDateTimeUnit) => Date

Defined in: types.ts:168

Returns a new Date offset from the input by amount units of unit (negative amount moves into the past).

Parameters

ParameterType
dDateOrString
amountnumber
unitRelativeDateTimeUnit

Returns

Date


endOf

endOf: (d: DateOrString, unit: RelativeDateTimeTruncationUnit) => Date

Defined in: types.ts:163

Returns a new Date advanced to the end of the given period (the last representable instant within it).

Week start follows the date library's own default/locale (see RQBDateTimeLibraryAPI.startOf).

Parameters

ParameterType
dDateOrString
unitRelativeDateTimeTruncationUnit

Returns

Date


format

format: (d: DateOrString, fmt: string) => string

Defined in: types.ts:111

Formats a date as a string.

Parameters

ParameterType
dDateOrString
fmtstring

Returns

string


isAfter

isAfter: (a: DateOrString, b: DateOrString) => boolean

Defined in: types.ts:120

Determines whether the first date is after the second date.

Parameters

ParameterType
aDateOrString
bDateOrString

Returns

boolean


isBefore

isBefore: (a: DateOrString, b: DateOrString) => boolean

Defined in: types.ts:124

Determines whether the first date is before the second date.

Parameters

ParameterType
aDateOrString
bDateOrString

Returns

boolean


isSame

isSame: (a: DateOrString, b: DateOrString) => boolean

Defined in: types.ts:133

Determines whether the first date is the same as the second date.

If either the first date or the second date is a string in the format 'YYYY-MM-DD', then the dates will only be compared at the date level (no time component). Otherwise, they will be compared to the millisecond.

Parameters

ParameterType
aDateOrString
bDateOrString

Returns

boolean


isValid

isValid: (d: DateOrString) => boolean

Defined in: types.ts:138

Determines whether the date is either a valid Date object or an ISO 8601-formatted string representing a valid date.

Parameters

ParameterType
dDateOrString

Returns

boolean


startOf

startOf: (d: DateOrString, unit: RelativeDateTimeTruncationUnit) => Date

Defined in: types.ts:156

Returns a new Date truncated to the start of the given period.

Week start follows the date library's own default/locale (e.g. Luxon uses Monday per ISO 8601; Day.js and date-fns default to Sunday).

Parameters

ParameterType
dDateOrString
unitRelativeDateTimeTruncationUnit

Returns

Date


toDate

toDate: (d: DateOrString) => Date

Defined in: types.ts:142

Converts a string to a Date object or returns a valid Date as is.

Parameters

ParameterType
dDateOrString

Returns

Date


toISOString

toISOString: (d: DateOrString) => string

Defined in: types.ts:149

Converts a Date or ISO 8601-formatted string into a full ISO 8601 UTC string, in the format 'YYYY-MM-DDTHH:mm:ss.SSSZ' (the "T" and "Z" are static; other parts represent standard time units, increasing in precision from left to right).

Parameters

ParameterType
dDateOrString

Returns

string


toISOStringDateOnly

toISOStringDateOnly: (d: DateOrString) => string

Defined in: types.ts:116

Formats a date as an ISO 8601 string, only including the year, month, and day ('YYYY-MM-DD').

Parameters

ParameterType
dDateOrString

Returns

string


caution

API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.