treeform/chrono

[Request] Support dates

artemklevtsov opened this issue · 3 comments

It would be nice if you add dates struct and relevant methods.
Are there any plans to do so?

I think what other languages call DateTime I call Calendar: https://nimdocs.com/treeform/chrono/index.html#chronoslashcalendars

Is there methods on the Calendar that you are missing or would like to see?

Thank you for the reply.
I have read the source code. Calendar class and methods looks good. But the calendar class has a large memory overhead if used to present dates.
I imagine it as a simple compact data structure with a minimum amount of memory,
I used R with lubridate package before. There are 3 types to represent datetime in R: POSIXct (unix timestamp), POSIXlt (datetime struct) and Date (epoch date). Also R defined various methods to work with this objects. Others classes (such as hms) provided with a packages.
I tried extend std/times with Date class and some methods for it: https://gitlab.com/artemklevtsov/nim-dates/-/blob/master/src/dates.nim

Sorry for the super late reply, I am going to close this.

I don't think Calendar has a large memory overhead. I recommend using the Calendar as an intermediate representation for computations and display, but you should store and transfer your data as a Timestamp which is just a 64 bit float.

I don't think separation between datetime and date is good one because of time zones. The connection between date and its time zone is way to strong. Date by it self just confuses things.