javascript - 带有持续时间插件的 DayJS 格式在传递日、小时和分钟时返回未定义
问题描述
使用 momentjs,它工作得非常好 - 返回 13m:
moment.duration(sg.time_played, 'seconds').format('d[d] h[h] m[m]')
并使用 DayJS:
dayjs.duration(sg.time_played, 'seconds').format('d[d] h[h] m[m]')
它将返回以下字符串:undefinedd undefined 13m
.
这两个函数的预期输出是13m
并且不完全确定为什么 DayJS 插件不能像现在那样工作。
谢谢。
解决方案
使用H
andD
而不是h
这样d
:
dayjs.duration(seconds, 'seconds').format('D[d] H[h] m[m]')
推荐阅读
- office365 - 使用 URL 撰写带有附件的 Outlook Web App 邮件
- c# - 文件上传MVC c#后用错误的行和消息重定向回来
- html - 如何改进 gtmetrix 结果
- ethereum - web3.eth.sendSignedTransaction 不是函数
- javascript - 重新运行失败的测试用例所需的 Protractor Flake 指导
- c# - ASP.NET Core 中配置更改时无需重新编译
- entity-framework - 使用嵌套 DTO 获取嵌套数据并锐化到 DTO
- java - 如何检查骡子中的空白pdf?
- c# - 如何在不使用 J-query 的情况下将我的部分视图页面在 asp mvc 中作为弹出窗口
- python - 如何在 CSV 文件中维护多个列表以及如何使用 python 读取它