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

add test cases for superfluous days #263

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

TymekDev
Copy link

This PR adds cases for whole years and whole months to not have extra days, e.g. May (2023-05-11T00:00:00.00) to July (2023-07-11T00:00:00.00) being 2 months instead of current 2 months, 1 day.

Related issue: #262

@TymekDev TymekDev requested a review from a team as a code owner July 11, 2023 20:53
@primer-css
Copy link

👋 Hello and thanks for pinging us! This issue or PR has been added to our inbox and a Design Infrastructure first responder will review it soon.

  • 🎨 If this is a PR that includes a visual change, please make sure to add screenshots in the description or deploy this code to a lab machine with instructions for how to test.
  • If this is a PR that includes changes to an interaction, please include a video recording in the description.
  • ⚠️ If this is urgent, please visit us in #primer on Slack and tag the first responders listed in the channel topic.

@lesliecdubs lesliecdubs requested a review from keithamus July 11, 2023 23:26
@lukasoppermann
Copy link

I'd love for @keithamus to approve this as he is working on it. Fine from primer FR side

@keithamus
Copy link
Member

Thanks, I'm looking into fixing this but I have higher priorities for now. A fix will come though!

@keithamus keithamus self-assigned this Aug 21, 2023
@keithamus keithamus requested review from joshblack and removed request for keithamus November 18, 2024 17:28
@joshblack
Copy link

Sorry for the delay on my end, adding this to the first responder board to pick up 👀 @keithamus just wanted to check-in, what are the next steps for this?

@camertron
Copy link

I looked into this today and have become thoroughly confused. Are you specifying any precision argument anywhere?

If I try copy/pasting your test cases into example/index.html, it always gives me something like "1 year, 6 days, 4 minutes, 24 seconds." I don't understand why the tests fail the way they do when no precision is specified.

@TymekDev
Copy link
Author

@camertron according to the README the precision defaults to second, so I'd assume that's how it works. I don't think it changes anything in this context, though.

I just put this into an HTML (using v4.4.4 via npm):

<relative-time format="duration" datetime="1944-12-13"></relative-time>

It showed "81 years, 2 months, 22 hours, 21 minutes, 45 seconds" for me. Even if I set the precision as high as year, then that would still be wrong—it should be 80 years. In other words, given a long enough duration, all precision levels are affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants