Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ReimplementelapsedTime to be precise#299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
leduyquang753 wants to merge3 commits intogithub:main
base:main
Choose a base branch
Loading
fromleduyquang753:elapsedTime

Conversation

leduyquang753
Copy link
Contributor

@leduyquang753leduyquang753 commentedDec 31, 2024
edited
Loading

(This is part of a set of multiple pull requests looking to overhaul the calculation functions.)

The current implementation ofelapsedTime just assumes there are 30 days in a month, which causes overshoots whenroundToSingleUnit takes its result and, in a rather roundabout way, tries to compute the original date back.

This pull request reimplements the function so that it is consistent withapplyDuration: applying the duration to the reference date always gives the original input date.

In math form:

If diff = date2 - date1 (elapsedTime)then date2 = date1 + diff (applyDuration)

In code:

applyDuration(date1,elapsedTime(date2,'second',date1))===date2

The new implementation is consistent with `applyDuration` so that:if with `elapsedTime`: diff = d2 - d1then with `applyDuration`: d1 + diff == d2
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@leduyquang753@keithamus

[8]ページ先頭

©2009-2025 Movatter.jp