DateInterval add possibility to have the result in hours, minutes, seconds
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Hi,
is it possible to have the result of a DateInterval in numbers of hours, minutes, seconds like this
Example you have a DateInterval with 48hours
(\DateInterval::createFromDateString('2 days'))->h // result 0
(\DateInterval::createFromDateString('2 days'))->totalHours // result 48
(\DateInterval::createFromDateString('2 days'))->totalMinutes // result 2880
(\DateInterval::createFromDateString('2 days'))->totalSeconds // result 172800
because if I do calculations on working hours for example it's easier for users to understand 48h00 instead of 2days 00h 00minutes and if I have to redo calculations and I need the hours, I have to reconvert the 2 days in hours and add them to the hours...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the DateInterval API entry point shown in the examples and determine how intervals such as 2 days currently expose their component values. The issue names no implementation files or tests, so locate the relevant DateInterval coverage before deciding the expected total-hour, total-minute, and total-second behavior. Done means the requested totals are available and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100