Skip to contents

Generate a regular expression matching an ISO8601 calendar date

Usage

pattern_ISO8601_calendar_date(
  truncated = 0,
  allow_before_year_1583 = FALSE,
  pattern_time = "",
  ...
)

Arguments

truncated

Should the date be allowed to be truncated? An integer indicating the highest required precision (0=day is required, 1=month, and 2=year). A value of 3 will allow an empty string to match.

allow_before_year_1583

Should years between 0 and 1582 be allowed (they are only allowed in ISO 8601 with mutual agreement)

pattern_time

A string to add to the day for including time with date (see pattern_ISO8601_time())

...

Ignored

Details

This matches the general pattern of YYYY-MM-DD (year-month-day). Basic format (without dashes) is not supported.

References

https://en.wikipedia.org/wiki/ISO_8601