Parses a given string into a date object that you can further manipulate.
Parameters
- date: string
The date string to be parsed. - useCurrentYear: boolean (optional)
If set totrue
, the current year will be used when parsing the date. - inputLocale?: "pt" | "nl" | "en" | "de" | "ja" | "zh" | "fr" (optional)
The locale of the input date string. If not provided, the default locale will be used.
Examples
parse-date("2021-12-25", useCurrentYear=false, inputLocale="en")
Returns: 2021-12-25
parse-date("25/12/2021", useCurrentYear=false, inputLocale="pt")
Returns: 2021-12-25
parse-date("12/25/21", useCurrentYear=true, inputLocale="en")
Returns: 2022-12-15