Skip to content
Source
Sign inSign up
TanStack/time

docs: adr choosing a date and time handling solution #8

Closedbart-krakowski(GitHub profile, opens in a new tab)wants to merge 5 commits intov0 fromrefs/pull/8/headopened

Showing 2 changed files with 93 additions and 2 deletions.

x
0 of 2 viewed, 2 left
91 additions and 0 deletionsadr/choosing-a-date-time-handling-solution.mdAdded
View file
@@ -0,0 +1,91 @@
+# ADR: Choosing a Date and Time Handling Solution
+​
+## Status
+​
+Accepted, decided on Temporal API.
+​
+## Context
+​
+In modern web applications, accurate and efficient handling of dates and times is crucial. Traditional JavaScript `Date`` objects have several limitations and pitfalls, including:
+- Lack of support for different calendars
+- Difficulties with time zone conversions
+- Ambiguous and error-prone APIs for date and time manipulation
+​
+These issues often lead to bugs and inefficiencies in handling date and time data, especially in complex applications that require extensive date and time manipulations, such as calendar applications.
+​
+## Decision
+​
+After evaluating several options, we have decided to adopt the Temporal API for all date and time handling in our application. Temporal is a new standard for working with dates and times in JavaScript, designed to provide a more reliable, readable, and easy-to-use API.
+​
+### Evaluation of Alternatives
+​
+1. **JavaScript `Date`**
+ - **Pros**:
+ - Built-in and requires no additional dependencies.
+ - Supported natively in all JavaScript environments.
+ - **Cons**:
+ - Ambiguous and error-prone API.
+ - Poor support for time zones and different calendars.
+ - Mutable objects, leading to potential bugs.
+ - Date arithmetic is complex and error-prone.