question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Converting to ISO 8601 standard duration format

See original GitHub issue

Hi 👋🏼,

First of all, thank you for this great library 😃

I couldn’t find a way to convert the minutes or hours to ISO 8601 duration format. For example:

With moment.js I can do;

moment.duration(30, 'minutes').toISOString();
// output: PT30M

moment.duration(70, 'minutes').toISOString();
// output: PT1H10M

Couldn’t find a way to do the same thing in dayjs.

Any suggestions?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
suyalcinkayacommented, Mar 6, 2019

@mariomc Thanks mate. But it looks like it does the opposite thing for what I need.

0reactions
iamkuncommented, Apr 9, 2019

#564 todo: Duration plugin

Read more comments on GitHub >

github_iconTop Results From Across the Web

Temporal.Duration - TC39
Briefly, the ISO 8601 notation consists of a P character, followed by years, months, weeks, and days, followed by a T character, followed...
Read more >
How to parse ISO 8601 duration strings in JavaScript - Twilio
This format displays a duration in the following format: PnYnMnDTnHnMnS where n is the number for the corresponding interval: Y = years; M...
Read more >
Time Duration Calculator - 345Tool.com
Time Duration Calculator · 60 Minutes · 1 Hours · 0.0416667 Days · 0.0013889 Months · 0.0001142 Years ...
Read more >
What is the value of the ISO 8601 duration `P1M` (in seconds)?
For 30-day months, it might be 2,592,000. For 31-day months, it might be 2,678,400. In February, it might be 2,419,200 or it might...
Read more >
Format time period links - ISO Codes - Workiva Support
Time period, ISO 8601 format ; Three years six months (or 3 years 6 months), P3Y6M ; 21 days or twenty-one days, P21D ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found