Add isoDateTimeSecond action for ISO 8601 local timestamps without timezone#1418
Add isoDateTimeSecond action for ISO 8601 local timestamps without timezone#1418
isoDateTimeSecond action for ISO 8601 local timestamps without timezone#1418Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…mezone Co-authored-by: fabian-hiller <35291865+fabian-hiller@users.noreply.github.com>
isoDateTimeSecond action for ISO 8601 local timestamps without timezone
commit: |
There was a problem hiding this comment.
Pull request overview
Adds a new isoDateTimeSecond validation action to cover ISO 8601 local date-times with seconds (no timezone designator), complementing existing isoDateTime (minutes) and isoTimestamp (timezone required).
Changes:
- Introduces
ISO_DATE_TIME_SECOND_REGEX(yyyy-mm-ddThh:mm:ss, also allowing a space separator). - Adds
isoDateTimeSecondaction (+ types) with runtime + type-level tests and exports it from the actions barrel. - Documents the new action/types and links them from the API menu and pipelines guide.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/src/routes/guides/(main-concepts)/pipelines/index.mdx | Adds isoDateTimeSecond to the validation actions list. |
| website/src/routes/api/menu.md | Adds API menu entries for isoDateTimeSecond and its action/issue types. |
| website/src/routes/api/(types)/IsoDateTimeSecondIssue/properties.ts | Defines property metadata for IsoDateTimeSecondIssue docs. |
| website/src/routes/api/(types)/IsoDateTimeSecondIssue/index.mdx | Adds the API docs page for IsoDateTimeSecondIssue. |
| website/src/routes/api/(types)/IsoDateTimeSecondAction/properties.ts | Defines property metadata for IsoDateTimeSecondAction docs. |
| website/src/routes/api/(types)/IsoDateTimeSecondAction/index.mdx | Adds the API docs page for IsoDateTimeSecondAction. |
| website/src/routes/api/(actions)/isoDateTimeSecond/properties.ts | Defines property metadata for isoDateTimeSecond docs. |
| website/src/routes/api/(actions)/isoDateTimeSecond/index.mdx | Adds the API docs page for isoDateTimeSecond. |
| library/src/regex.ts | Adds ISO_DATE_TIME_SECOND_REGEX. |
| library/src/actions/isoDateTimeSecond/isoDateTimeSecond.ts | Implements the new validation action and related interfaces. |
| library/src/actions/isoDateTimeSecond/isoDateTimeSecond.test.ts | Adds runtime tests for action shape and validation behavior. |
| library/src/actions/isoDateTimeSecond/isoDateTimeSecond.test-d.ts | Adds type-level tests for overloads and inferred types. |
| library/src/actions/isoDateTimeSecond/index.ts | Exports isoDateTimeSecond from its folder barrel. |
| library/src/actions/index.ts | Exports the new action folder from the actions barrel. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| '0000-01-01T00.00:00', | ||
| ]); | ||
| }); | ||
|
|
There was a problem hiding this comment.
The new action is intended to validate local date-times (no timezone designator), but the test suite doesn’t currently include an explicit case like 1995-03-31T00:00:00Z / ...+01:00 to assert that timezone suffixes are rejected. Adding a couple of these to the invalid inputs list would prevent accidental regex broadening in the future.
| test('for timezone designators', () => { | |
| expectActionIssue(action, baseIssue, [ | |
| '1995-03-31T00:00:00Z', | |
| '1995-03-31T00:00:00+01:00', | |
| ]); | |
| }); |
isoTimestamprequires a timezone designator andisoDateTimeonly validateshh:mm— there was no action for local date-time with seconds (1995-03-31T00:00:00). AddsisoDateTimeSecondto fill this gap, following the existingisoTime/isoTimeSecondnaming pattern.Library
regex.ts— NewISO_DATE_TIME_SECOND_REGEX:yyyy-mm-ddThh:mm:ss, no fractional seconds, space separator supported (consistent withisoTimeSecond)actions/isoDateTimeSecond/—IsoDateTimeSecondIssue,IsoDateTimeSecondActioninterfaces; two overloads (no-message / with-message); exported fromactions/index.tsWebsite
isoDateTimeSecond,IsoDateTimeSecondAction,IsoDateTimeSecondIssuemenu.md— three alphabetically-ordered entries addedpipelines/index.mdx—isoDateTimeSecondadded to validation actionsApiListUsage
Original prompt
This section details on the original issue you should resolve
<issue_title>Allow ISO 8601 timestamps with local time in
isoTimestampaction</issue_title><issue_description>The
isoTimestampaction only allows timestamps with a timezone designator such as UTC or a time offset. However, local timestamps without timezone should also be considered valid.https://en.wikipedia.org/wiki/ISO_8601#Local_time_(unqualified)
Example:
1995-03-31T00:00:00I'm working with an external data source that is scoped to a specific country with a uniform timezone and does only contain timestamps without timezone information.
</issue_description>
<agent_instructions>Read the issue comments and follow the implementation plan</agent_instructions>
Comments on the Issue (you are @copilot in this section)
@fabian-hiller @marianheinsen sorry for the late reply. Is this this relevant? If so, I will look into it. @fabian-hiller @dosu do a deep research and tell me what you think about this issue @fabian-hiller Hey I think I would expand the `isoDateTime` regex to support it or introduce a new `isoDateTimeSecond` action. This would fit into our current naming implementation. Happy to receive feedback on that. In the meantime I recommend using `regex` as a workaround. @fabian-hiller Here is a plan for the implementation:Plan: Add
isoDateTimeSecondActionContext
GitHub issue #1355:
isoTimestamprequires a timezone designator, andisoDateTimeonly acceptshh:mm(no seconds). There's no action for local date-time with seconds like1995-03-31T00:00:00. A newisoDateTimeSecondaction fills this gap, consistent with the existingisoTime/isoTimeSecondnaming pattern.Regex
Format:
yyyy-mm-ddThh:mm:ss— no fractional seconds (consistent withisoTimeSecondwhich also has no fractions).Files to Create
1.
library/src/actions/isoDateTimeSecond/isoDateTimeSecond.tsModeled after
isoDateTime.ts:IsoDateTimeSecondIssueinterface —type: 'iso_date_time_second'IsoDateTimeSecondActioninterface —type: 'iso_date_time_second',reference: typeof isoDateTimeSecondyyyy-mm-ddThh:mm:ss_addIssue(this, 'date-time-second', dataset, config)ISO_DATE_TIME_SECOND_REGEXfrom../../regex.ts2.
library/src/actions/isoDateTimeSecond/isoDateTimeSecond.test.tsModeled after
isoDateTime.test.ts:'0000-01-01T00:00:00','9999-12-31T23:59:59','2023-07-11T19:34:56''0000-01-01 00:00:00','2023-07-11 17:26:30','9999-12-31 23:59:59'3.
library/src/actions/isoDateTimeSecond/isoDateTimeSecond.test-d.tsModeled after
isoDateTime.test-d.ts:InferInput,InferOutput,InferIssuetype inference tests4.
library/src/actions/isoDateTimeSecond/index.tsFiles to Modify
5.
library/src/regex.ts(line ~103)Add after
ISO_DATE_TIME_REGEX:6.
library/src/actions/index.ts(line ~43)Add after the
isoDateTimeexport:Website Documentation
All new files are modeled after the existing
isoDateTimedocs. Use therepo-website-api-createskill for detailed conventions.7.
website/src/routes/api/(actions)/isoDateTimeSecond/properties.tsModeled after
isoDateTime/properties.ts. DefinesTInput,TMessage,message, andActionproperties with types referencingIsoDateTimeSecondIssueandIsoDateTimeSecondAction.