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

Support for Duration "part" methods #471

Open
MMauro94 opened this issue Feb 17, 2021 · 2 comments
Open

Support for Duration "part" methods #471

MMauro94 opened this issue Feb 17, 2021 · 2 comments

Comments

@MMauro94
Copy link

Hi, would it be possible to add the following methods to the Duration class:

  • toDaysPart()
  • toHoursPart()
  • toMinutesPart()
  • toSecondsPart()
  • toNanosPart()

They should mimic the behavior of java.time.Duration (they extract the "part" information of the respective unit). Example:

const d = Duration.parse("PT1H30M20S"); //1 hour, 30 minutes, 20 seconds

d.toHours(); // 1
d.toHoursPart(); // 1

d.toMinutes(); // 90
d.toMinutesPart(); // 30

d.seconds(); // 5420
d.toSecondsPart(); // 20
@pithu
Copy link
Member

pithu commented Apr 11, 2021

Yes, since it is part of the threeten API we would accept pull requests for it.

@github-actions
Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jan 12, 2022
@pithu pithu removed the Stale label Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants