我正在寻找一个 JS 库/实用程序/函数,您可以在其中给它指定月数,它会返回它的人类可读版本。
我几乎已经在 Vanilla JS 中完成了,但现在我发现有很多边缘情况我不想重新发明轮子。
例子
func(3) => "3 Months"
func(1) => "1 Month" // singular
func(0.1) => "1 Week"
func(0.25) => "2 Weeks"
func(13) => "1 year and 1 month"
func(14) => "1 year and 2 months"
func(14.25) => "1 year, 2 months and two weeks"
.
..
...etc
问题陈述:我不想重新发明轮子,看看有没有像上面那样目前正在做日期转换的库。
慕桂英546537
拉丁的传说
慕神8447489
相关分类