zed icon indicating copy to clipboard operation
zed copied to clipboard

Support month unit and proper years in duration

Open chrismo opened this issue 4 months ago • 2 comments

Primitive Values in the 1.18 docs show that "month" is not included unit in the type:

Valid time units are "ns" (nanosecond), "us" (microsecond), "ms" (millisecond), "s" (second), "m" (minute), "h" (hour), "d" (day), "w" (7 days), and "y" (365 days). Note that each of these time units accurately represents its calendar value, except for the "y" unit, which does not reflect leap years and so forth. Instead, "y" is defined as the number of nanoseconds in 365 days.

I presume this is because dealing with the varying lengths of months is some work, same as dealing with leap years. I have a use-case working moving dates where having month support would be handy. Instead, I'll drop back to the shell and use GNU date for what I need.

chrismo avatar Oct 13 '24 13:10 chrismo