# plainDate

Industry: Core

```ts
const plainDate: RegExp = /^(?:\d{4}|\+\d{6}|-(?!0{6})\d{6})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/;
```

RegExp matching ISO 8601 calendar date (extended): `YYYY-MM-DD` or `±YYYYYY-MM-DD`.

## Examples

```ts
import { plainDate } from "@northguild/gmt";
```

```ts
plainDate.test("2024-03-15") // true
plainDate.test("+000031-04-30") // true (6-digit year)
plainDate.test("-000031-04-30") // true (negative 6-digit year)
plainDate.exec("2024-03-15")?.slice(1) // ["03", "15"] (month, day)
plainDate.test("-000000-01-01") // false (negative zero year)
plainDate.test("2024-3-15") // false (unpadded month)
plainDate.test("2024-03-00") // false (day zero)
```

## Source

[regex/date.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/regex/date.ts)
