Add support for TC39 Temporal API
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 36.7k
- Forks
- 6.7k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 6
Description
Feature Description
JavaScript's built-in Date object makes it difficult to clearly handle time zone-aware date/time values, time-only values, and date-only values.
Because a single Date type is used for all of these cases, timezone handling and conversion logic can become confusing and error-prone.
Temporal would provide a more explicit and reliable way to represent these date/time use cases.
Temporal has also reached TC39 Stage 4 and is now part of the JavaScript standard.
The Solution
The Solution
@Entity()
export class Schedule {
@PrimaryGeneratedColumn()
id: number;
@Column()
date: Temporal.PlainDate;
@Column()
startedTime: Temporal.PlainTime;
@Column()
endedTime: Temporal.PlainTime;
@Column()
startedAt: Temporal.ZonedDateTime;
}
| Temporal Type | PostgreSQL | MySQL |
|---|---|---|
| Temporal.PlainDate | DATE | DATE |
| Temporal.PlainTime | TIME | TIME |
| Temporal.PlainDateTime | TIMESTAMP | DATETIME |
| Temporal.ZonedDateTime | TIMESTAMP WITH TIME ZONE | TIMESTAMP |
| Temporal.Instant | TIMESTAMP WITH TIME ZONE? | TIMESTAMP? |
Considered Alternatives
- Continue using
Datewith custom transformers - Store Temporal values as strings and convert them manually
These approaches work as a workaround, but they still require repetitive conversion logic and do not provide a first-class, type-safe Temporal integration.
Additional Context
No response
Relevant Database Driver(s)
- aurora-mysql
- aurora-postgres
- better-sqlite3
- capacitor
- cockroachdb
- cordova
- expo
- mongodb
- mysql
- nativescript
- oracle
- postgres
- react-native
- sap
- spanner
- sqlite
- sqljs
- sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, but I don't know how to start. I would need guidance.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names TypeScript entity fields and the MySQL and PostgreSQL drivers, but no files, tests, or entry points. Start by tracing existing Date column handling for those drivers and defining mappings for the listed Temporal types; done means Temporal-valued entity columns work correctly with the requested database types and are covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mysql, postgresql, typescript
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100