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 support for ASP.NET style time spans #2469

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

AntonRunDev
Copy link

The goal of this PR is to extend the Duration plugin so that it will support parsing strings in ASP.NET style time spans.

It can now parse the string in the following formats:

  • dayjs.duration('2.01:01:01.100')
  • dayjs.duration('2 01:01:01.100')
  • dayjs.duration('01:01:01.100')
  • dayjs.duration('01:01:01')
  • dayjs.duration('01:01')

The format is an hour, minute, second string separated by colons like 23:59:59. The number of days can be prefixed with a dot or space separator like 7.23:59:59 or 7 23:59:59. Partial seconds are supported as well 23:59:59.999.

As of version 2.1.0, momentjs supports this format https://momentjs.com/docs/#/durations/:~:text=As%20of%202.1.0%2C%20moment%20supports%20parsing%20ASP.NET%20style%20time%20spans.%20The%20following%20formats%20are%20supported.

@codecov
Copy link

codecov bot commented Oct 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (bdcc336) 99.77% compared to head (0ded945) 99.77%.

❗ Current head 0ded945 differs from pull request most recent head aef1fb6. Consider uploading reports for the commit aef1fb6 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #2469   +/-   ##
=======================================
  Coverage   99.77%   99.77%           
=======================================
  Files         183      183           
  Lines        2262     2270    +8     
  Branches      641      644    +3     
=======================================
+ Hits         2257     2265    +8     
  Misses          5        5           

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

@netcoding87
Copy link

Any plans when this can be merged and released?

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.

None yet

2 participants