Comments (1)
Other date and time library like luxon
start from the lowest to the greatest unit.
There is no standard for normalising with some AI knowledge, and research I found two option:
- Conversion to Milliseconds: While straightforward, this method might suffer from precision loss due to floating-point arithmetic. It can be efficient for large duration ranges but may not be ideal for high-precision needs.
- Unit-by-Unit Cut and Distribute: This approach iterates through units from smallest to largest, performing rounding/truncation and carrying over excess to the next unit. It can be more accurate for shorter durations and finer units but may be less efficient for very large durations.
Other considerations can be:
- Granularity Level:
If high precision is required, normalization to smaller time units (seconds, milliseconds) may be necessary.
However, this can increase the complexity and computational burden of the process.
- Contextual Understanding:
Normalization must be consistent with the meaning and usage of the duration in the specific context.
For example, normalizing a flight duration may differ from normalizing an industrial process duration.
- Computational Efficiency:
Normalization can be a complex operation, especially for long periods of time.
It is important to evaluate the computational impact of normalization and choose an efficient method.
from date-fns.
Related Issues (20)
- Problem in subDays documentation HOT 1
- Suggestion: add some way to link to notes
- Problem in yearsToDays documentation
- Vue 3 compatibility HOT 1
- Problem with lastDayOfMonth function HOT 1
- Problem in roundToNearestMinutes(ceil and floor is not working) HOT 2
- Problem with parseJSON function arg type on v3 HOT 2
- Upgrading from 2.30.0 to 3.x.x breaks Vite build HOT 4
- Confusing documentation around `isValid()`/`toDate()`
- `addDays` rounds the `amount` without any hint in the documentation
- Add a disclaimer or remove Timezone page HOT 3
- [Feature request] formatSQL() as an alias for formatISO9075()
- The descriptions in the sample code are at variance with the code HOT 2
- Formatting time only, using a number, is off by an hour HOT 2
- Problem with intervalToDuration function - zeros are not included in the output
- Problem in yearsToDays documentation HOT 1
- Tatar language support
- fa-IR HOT 1
- formatDistanceToNow behavior around the month of February
- removing one day from on leap year. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from date-fns.