Timex.format seems off at the end of the month

未关闭
#732 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
elixir
领域
backend

调研方向

首先使用 "{relative}" formatter 和 :relative 选项重现报告中的 Timex.shift 和 Timex.format! 调用,然后检查 relative formatting 的入口点。比较接近月份边界时以及增加一小时后的结果。当示例报告出预期的月份数,并且回归覆盖证明行为已得到修正时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Steps to reproduce
iex> in_5_months = Timex.shift(Timex.now(), months: 5)   
~U[2023-06-30 07:51:27.003055Z]
iex> Timex.format!(in_5_months, "{relative}", :relative) 
"in 4 months"
Description of issue
  • Timex.format seems to miss a month - the result should be "in 5 months", instead of "in 4 months". The output of Timex.shift looks good.
  • It seems the error is only occuring starting recently, it was fine before.
  • At first I thought it was because due to me testing on the 31st. But apparently the issue is not related to the date. I guess it depends if Timex.format does some rounding? Otherwise 5 months - a few secons is already 4 months. It works fine if I add another hour. I'm just curious why it worked before.

Could this be related to this issue? https://github.com/bitwalker/timex/issues/535

I hope I didn't miss any other open issue related to this. Thank you for the great work!

主要语言
Elixir
星标
1.8k
派生
408
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bitwalker/timex 的其他 Issue

查看 bitwalker/timex 的全部 Issue

相似的 Issue

更多 Elixir Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。