Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

front: fix rounded hours #10766

Merged
merged 1 commit into from
Feb 25, 2025
Merged

front: fix rounded hours #10766

merged 1 commit into from
Feb 25, 2025

Conversation

Akctarus
Copy link
Contributor

closes #9179

@Akctarus Akctarus requested a review from a team as a code owner February 11, 2025 14:46
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Feb 11, 2025
@codecov-commenter
Copy link

codecov-commenter commented Feb 11, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.53%. Comparing base (3ebcea2) to head (4ece033).
Report is 4 commits behind head on dev.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #10766      +/-   ##
==========================================
- Coverage   82.53%   82.53%   -0.01%     
==========================================
  Files        1086     1086              
  Lines      107928   107931       +3     
  Branches      740      740              
==========================================
- Hits        89080    89077       -3     
- Misses      18806    18812       +6     
  Partials       42       42              
Flag Coverage Δ
editoast 74.37% <ø> (-0.02%) ⬇️
front 90.36% <100.00%> (+<0.01%) ⬆️
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.58% <ø> (ø)
tests 87.90% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Akctarus Akctarus requested a review from a team as a code owner February 11, 2025 15:07
@Akctarus Akctarus force-pushed the tmn/front/fix-rounded-times branch 2 times, most recently from 8e03a12 to 2d9c0c1 Compare February 11, 2025 15:09
Copy link
Member

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, I think dayjs is already expected to handle this case?

https://day.js.org/docs/en/customization/relative-time#relative-time-thresholds-and-rounding

@Akctarus
Copy link
Contributor Author

Akctarus commented Feb 11, 2025

Weird, I think dayjs is already expected to handle this case?

https://day.js.org/docs/en/customization/relative-time#relative-time-thresholds-and-rounding

dayjs has built-in rounding behaviors, but by default, it does not round up minutes when seconds are >=30

@emersion
Copy link
Member

Right, but it can be configured to do so, right? (See above link)

@Akctarus
Copy link
Contributor Author

Right, but it can be configured to do so, right? (See above link)

you mean something like that ? fc1ebcd

@Akctarus Akctarus force-pushed the tmn/front/fix-rounded-times branch from fc1ebcd to 3e4460a Compare February 18, 2025 15:26
@Akctarus Akctarus requested a review from emersion February 19, 2025 13:41
@emersion
Copy link
Member

Ew, my bad, it seems like the options I've linked to only apply to the relative time plugin, which we don't use.

Ideally we'd use a rounding function (just like Temporal has) but it seems like the library is missing that.

Oh well, let's just go with your original solution then, sorry for the noise!

@Akctarus Akctarus force-pushed the tmn/front/fix-rounded-times branch 2 times, most recently from ac7cd0f to f0b3131 Compare February 24, 2025 13:58
@Akctarus
Copy link
Contributor Author

@emersion Done !

@Akctarus Akctarus requested a review from Maymanaf February 24, 2025 13:59
Copy link
Member

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Ideally these commits would be squashed together so that the tests don't regress in-between the commits (useful when bisecting).

@Akctarus Akctarus force-pushed the tmn/front/fix-rounded-times branch from f0b3131 to e0e456d Compare February 25, 2025 08:37
Signed-off-by: Theo Macron <[email protected]>
@Akctarus Akctarus force-pushed the tmn/front/fix-rounded-times branch from e0e456d to 4ece033 Compare February 25, 2025 08:38
@Akctarus Akctarus enabled auto-merge February 25, 2025 08:38
@Akctarus Akctarus added this pull request to the merge queue Feb 25, 2025
Merged via the queue into dev with commit f7cc3f6 Feb 25, 2025
27 checks passed
@Akctarus Akctarus deleted the tmn/front/fix-rounded-times branch February 25, 2025 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:front Work on Standard OSRD Interface modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Departure and arrival times are rounded down in the train list
4 participants