dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

Add parsing ASP.NET style time duration for Duration plugin

Open luozz1994 opened this issue 4 years ago • 2 comments

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 a space separator like so 7.23:59:59 or 7 23:59:59. Partial seconds are supported as well 23:59:59.

dayjs.duration('23:59:59');
dayjs.duration('7.23:59:59');
dayjs.duration('7 23:59:59');
dayjs.duration('23:59');

Note: This usage method depends on Duration plugin

luozz1994 avatar Sep 03 '21 05:09 luozz1994

Well, I think dayjs should only parse standard ISO format.

Maybe it will be better to publish this ASP duration parser dayjs plugin as a separate package.

iamkun avatar Sep 10 '21 09:09 iamkun

Codecov Report

Merging #1624 (f7fbf06) into dev (f68e4b1) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##               dev     #1624   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          177       179    +2     
  Lines         1989      2004   +15     
  Branches       505       508    +3     
=========================================
+ Hits          1989      2004   +15     
Impacted Files Coverage Δ
src/plugin/duration/index.js 100.00% <100.00%> (ø)
src/locale/nb.js 100.00% <0.00%> (ø)
src/locale/ar-iq.js 100.00% <0.00%> (ø)
src/locale/es-mx.js 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f68e4b1...f7fbf06. Read the comment docs.

codecov[bot] avatar Sep 14 '21 09:09 codecov[bot]