Skip to content

supporting ECMAScript Temporal #3663

@jochemd

Description

@jochemd

Word is that Temporal has reached Stage 4 and will be included in the next ECMAScript draft. I think it looks very promising and will allow for much better support for some PostgreSQL datatypes by mapping them to proper types instead of strings.
I took Temporal for a spin with the latest NodeJS nightly and ran some really basic happy path tests for the no-brainer datatype mappings:

  1. Temporal.Duration to PostgreSQL interval
  2. Temporal.PlainDate to PostgreSQL date
  3. Temporal.PlainTime to PostgreSQL time

Other mappings might not be so obvious and/or a matter of personal preference (e.g. I have no use for Temporal.ZonedDateTime and strongly prefer to get everything out of the database as Temporal.Instant). And obviously backward compatibility is its own can of worms.

Temporal support was also requested in the pg@9.0 breaking changes ideas discussion, but it has not been added to the pg@9.0 milestone. Is there a specific reason temporal not added to the milestone? Sorting out pg_types first?

Is there a template/guidance on how to propose changes that are not backward-compatible and can be enabled using a simple mechanism so it is possible to just add one option / env variable that switches all datetime parsing to Temporal datatypes instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions