Go carbon version 1.2.7 is released, and methods such as yesterday() and tomorrow() are optimized

Time:2021-9-18

Carbon is a lightweight, semantic and developer friendly golang time processing library, which supports chain calls, lunar calendar, Gorm, xorm and other mainstream orm

If you feel good, please give a star

github:github.com/golang-module/carbon

gitee:gitee.com/go-package/carbon

//Yesterday at this moment
carbon.Yesterday().ToDateTimeString() // 2020-08-04 13:14:15
//Yesterday and now of the specified date
carbon.Parse("2021-01-28 13:14:15").Yesterday().ToDateTimeString() // 2021-01-27 13:14:15

//Now tomorrow
carbon.Tomorrow().ToDateTimeString() // 2020-08-06 13:14:15
//Tomorrow of the specified date
carbon.Parse("2021-01-28 13:14:15").Tomorrow().ToDateTimeString() // 2021-01-29 13:14:15

Update log

  • Fix partial description error in readme.md document
  • Fixed missing in (c.loc) in todaydatetimestring() method
  • Fix the judgment error of isyesterday() method in some cases
  • Fix the judgment error of istomorrow() method in some cases
  • Remove parsebyduration() method
  • The yesterday() method is optimized to support yesterday of the specified time. If no time is specified, it defaults to yesterday of the current time
  • Optimize the tomorrow () method to support tomorrow at the specified time. If no time is specified, it defaults to tomorrow at the current time
  • Optimize the format () method and add support for N, l, G, u, O, P, t and other formatting symbols

This work adoptsCC agreement, reprint must indicate the author and the link to this article