From 519f9ad03d73174e2fb74d62ca66df4520249dc7 Mon Sep 17 00:00:00 2001 From: Gabriel Grant Date: Mon, 9 Dec 2024 14:52:48 -0500 Subject: [PATCH] docs: clarify date string literals description (#1224) --- ark/docs/src/content/docs/objects.mdx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ark/docs/src/content/docs/objects.mdx b/ark/docs/src/content/docs/objects.mdx index 8d68d26ab1..90b2f41953 100644 --- a/ark/docs/src/content/docs/objects.mdx +++ b/ark/docs/src/content/docs/objects.mdx @@ -514,7 +514,11 @@ const myTuple = type(["...", type.number.array(), type.boolean, type.string]) Date literals represent a Date instance with an exact value. -They're primarily useful in ranges. +It is recommended that the date literal string content be in [JavaScript date-time format](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format). +The value of a Date literal is determined by constructing a `new Date(dateLiteralContents)`, though, so [any string format accepted by `Date()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date#datestring) is acceptable. +A Date literal that results in an invalid Date will throw a ParseError. + +Date literals are primarily useful in ranges. ```ts const literals = type({