Core
Framework v2.x
2

getDate #

Available since 2.18.0

Gets a parameter from the request arguments and checks that it is a valid date.

Without format, the value must be a string holding a valid ISO 8601 date. With format, it must strictly match that moment.js format instead, such as DD/MM/YYYY.

Before 2.60.0, a format was checked on top of the ISO 8601 check, so a format that is not ISO 8601 rejected every value.

Throws an api.assert.missing_argument error if the parameter is not set, and an api.assert.invalid_type error if it is not a valid date.

Arguments #

getDate (name: string, format?: string): string
NameTypeDescription
name
string
Parameter name
format
string
Optional moment.js format the date must match, instead of ISO 8601 (e.g. DD/MM/YYYY)

Example #

const startDate = request.getDate('startDate');
// e.g. "2026-10-27T10:00:00Z"

const day = request.getDate('day', 'DD/MM/YYYY');
// e.g. "27/10/2026"