Skip to content

[REQ] Support Temporal for typescript(-angular) #22674

@cromefire

Description

@cromefire

Is your feature request related to a problem? Please describe.

Date time has been a mess so far, with JS as the Date type just has tons of issues. (For example no equivalent to OffsetDateTime exists). Some mappings from the OpenAPI spec can't currently be properly done with this API.

Describe the solution you'd like

Temporal has been introduced as a new standard API across the web to fix this issue. It now ships in 2/3 major browser engines, Firefox since like the better part of a year now and Chromium since last week (currently rolling out to users) and Apple also has some... let's call them beginnings going in their TP apparently (not an issue for me, but a polyfill is available until auch time as they get it done properly).

Ideally it'd be introduced as an option for now and should probably be made default with the next major release, given Apple get's their stuff together in time (I'd imagine many need to support Apple stuff).

This would allow proper mapping of the following formats (from the format registry):

  • date-time: Temporal.ZonedDateTime
  • date-time-local: Temporal.PlainDateTime
  • date: Temporal.PlainDate
  • time: Temporal.PlainTime
  • possibly unixtimestamp: Temporal.Instant

Describe alternatives you've considered

Manually converting everything after the fact, but that gets annoying and very boilerplate-y very fast. Also some stuff ist just lost forever any can't be recovered. If an RFC3339 date is converted into a date, it's offset is lost forever as Date has no notion of timezones or anything similar.

Additional context

https://jsdate.wtf/
https://caniuse.com/temporal
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions