Date

Derived from String, the Internet Object Date is an ISO 8601 compatible date format. It can be represented as YYYY-MM-DD or YYYYMMDD i.e It can be passed with or without separators (- U+002D).

The value for the year must be provided as it does not takes any default value.

It prescribes a minimum four-digit year format from a range 0000 to 9999 to avoid the year 2000 problem. However, years from a range 1583 to 9999 are automatically allowed by a standard, while years prior to 1583 can only be used by mutual agreement of the partners in information interchange.

Here is the code snippet demonstrates, how to define and use date type.

# Defining date for registeredDate
registeredDate: date
---
~ 2020-09-17    
~ 20200917      # parsed as 2020-09-17
~ 2020-09       # parsed as 2020-09-01
~ 2019          # parsed as 2019-01-01

MemberDef

The Date is derived from the String type, hence it shares the same MemberDef as the String. However, Date enforces additional constraints with respective date format and the same is applicable to the Date MemberDef.

Last updated