squants
squants copied to clipboard
Add support for longer units of time
I'd be happy to tackle this but wanted to run it by others first. I'm primarily wanting: Weeks (28 days), Months (30 days), Years, GregorianYears.
Others that I may include while at it: Decade, Century, Millennium, and Fortnight (mostly for fun on this last one!).
Any comments/suggestions welcome.
This got me wondering, months could be anywhere from 29-31 days, How'd you handle that Even years vary and not only by being leap years
That's why I mentioned Year vs GregorianYear (the first is 365 days, the second is a bit off and would be defined down to the second to account for the average length of a year). Month is standardized at 30 days, I believe - if folks or looking for lengths of days for particular months, they would probably want to use a calendar library.
Do you have a use case for this, or is this just a general request for enhancement? Trying how to understand where to define a boundary between squants' time units and a calendar library.
I do have an application that makes heavy use of Months, and somewhat frequent use of Weeks and Years.
On Mon, May 1, 2017 at 4:15 PM, Derek Morr [email protected] wrote:
Do you have a use case for this, or is this just a general request for enhancement? Trying how to understand where to define a boundary between squants' time units and a calendar library.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/typelevel/squants/issues/228#issuecomment-298420739, or mute the thread https://github.com/notifications/unsubscribe-auth/AA37jnhS39F95ifRn4y3iYcEUvC91Q2dks5r1j1YgaJpZM4NNDx9 .
-- Brandon Barker [email protected]
Adding a note to consider other time-derived quantities (e.g., MassFlow), so that one could do
.toPoundsPerDay instead of toPoundsPerHour*24.
Months, years and longer units of time are not regular and require a calendar to do those operations correctly. I think a week should be the longest unit of time as its the longs one that is regular.