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

Converting to ISO 8601 standard duration format #519

Closed
suyalcinkaya opened this issue Mar 6, 2019 · 6 comments
Closed

Converting to ISO 8601 standard duration format #519

suyalcinkaya opened this issue Mar 6, 2019 · 6 comments

Comments

@suyalcinkaya
Copy link

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?

@ghost
Copy link

ghost commented Mar 6, 2019

Seems Duplicate of #414 ?

Or, more detail please?

@iamkun
Copy link
Owner

iamkun commented Mar 6, 2019

Maybe we need a dayjs. duration plugin?

@suyalcinkaya
Copy link
Author

@xxyuk
Well, that's all actually. Couldn't find a way to convert 30 minutes to PT30M.

@iamkun
I think we need one.

@mariomc
Copy link
Contributor

mariomc commented Mar 6, 2019

We had the same issue and ended up using ISO8601-duration (tested, pretty small, no dependencies) for that format parse and calculations.

@suyalcinkaya
Copy link
Author

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

@iamkun iamkun changed the title Converting to ISO 8601 standard Converting to ISO 8601 standard duration format Mar 10, 2019
@iamkun
Copy link
Owner

iamkun commented Apr 9, 2019

#564 todo: Duration plugin

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

No branches or pull requests

3 participants