Skip to content

Documentation / @jalali-js/i18n / parseTemplate

Function: parseTemplate()

parseTemplate(input, template, locale, options?): CalendarDate | null

Defined in: template.ts:136

Strictly parses input against a token template, the reverse of format() with options.template. Returns null when the input does not match the template's exact shape, when a field repeats with a different value, when the date does not exist, or when a weekday name does not match the parsed date.

Digits are accepted in Latin or in locale's native set. The template must produce a year, a month, and a day.

Parameters

input

string

template

string

locale

LocalePack

options?

ParseTemplateOptions = {}

Returns

CalendarDate | null