DateInterval add possibility to have the result in hours, minutes, seconds
未关闭
还没有人认领这个 Issue。
Extension: date
Feature
Status: Needs Triage
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.1k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
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...
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从示例中显示的 DateInterval API 入口点开始,确定当前 2 天之类的时间间隔如何公开其组成部分的值。该 issue 没有指出实现文件或测试,因此请先找到相关的 DateInterval 覆盖范围,再决定预期的总小时数、总分钟数和总秒数行为。完成的标准是所请求的总值可用,并且有测试覆盖。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- backend-api-design
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100