Skip to content

Commit

Permalink
Add DiffInDuration and DiffAbsInDuration methods
Browse files Browse the repository at this point in the history
  • Loading branch information
gouguoyin committed Feb 20, 2024
1 parent 00ac61a commit 3ea19ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,9 @@ now.DiffInDuration(now).String() // 0s
now.AddHour().DiffInDuration(now).String() // 1h0m0s
now.SubHour().DiffInDuration(now).String() // -1h0m0s
// 相差时长(绝对值)
now.DiffAbsInDuration(now) // 0s
now.AddHour().DiffAbsInDuration(carbon.Now()) // 1h0m0s
now.SubHour().DiffAbsInDuration(carbon.Now()) // 1h0m0s
now.DiffAbsInDuration(now).String() // 0s
now.AddHour().DiffAbsInDuration(now).String() // 1h0m0s
now.SubHour().DiffAbsInDuration(now).String() // 1h0m0s

// 对人类友好的可读格式时间差
carbon.Parse("2020-08-05 13:14:15").DiffForHumans() // just now
Expand Down
6 changes: 3 additions & 3 deletions README.jp.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,9 @@ now.DiffInDuration(now).String() // 0s
now.AddHour().DiffInDuration(now).String() // 1h0m0s
now.SubHour().DiffInDuration(now).String() // -1h0m0s
// 相差時間長(絶対値)
now.DiffAbsInDuration(now) // 0s
now.AddHour().DiffAbsInDuration(carbon.Now()) // 1h0m0s
now.SubHour().DiffAbsInDuration(carbon.Now()) // 1h0m0s
now.DiffAbsInDuration(now).String() // 0s
now.AddHour().DiffAbsInDuration(now).String() // 1h0m0s
now.SubHour().DiffAbsInDuration(now).String() // 1h0m0s

// 人間に優しい読み取り可能なフォーマットの時間差を取得します
carbon.Parse("2020-08-05 13:14:15").DiffForHumans() // just now
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,9 @@ now.DiffInDuration(now).String() // 0s
now.AddHour().DiffInDuration(now).String() // 1h0m0s
now.SubHour().DiffInDuration(now).String() // -1h0m0s
// Difference in duration with absolute value
now.DiffAbsInDuration(now) // 0s
now.AddHour().DiffAbsInDuration(carbon.Now()) // 1h0m0s
now.SubHour().DiffAbsInDuration(carbon.Now()) // 1h0m0s
now.DiffAbsInDuration(now).String() // 0s
now.AddHour().DiffAbsInDuration(now).String() // 1h0m0s
now.SubHour().DiffAbsInDuration(now).String() // 1h0m0s

// Difference in a human-readable format
carbon.Parse("2020-08-05 13:14:15").DiffForHumans() // just now
Expand Down

0 comments on commit 3ea19ad

Please sign in to comment.