eos
is a datetime library for Rust, aimed at being robust, simple, and easy to use. eos
is made with the assumption of operating under a proleptic Gregorian calendar. If you're looking for different calendar systems, similar to those in JavaScript's Temporal library, then this library is not for you. However, I am open to the idea of having calendar systems in the future.
Right now, this library is in its development phase.
There already exist well established libraries in the ecosystem to deal with both dates and times so it's fair to be skeptical of any new library in this space. However, this library was created due to inadequacies in current offerings when it came to more complicated use cases (such as timezones). I had wanted to create a library that was both simpler, more robust, and correct when it came to the complexities of dealing with time.
Special care has been taken to ensure timezones are implemented properly. To that end, there is no concept of a naive date time. The default timezone of a DateTime
type is UTC. All operations done on a DateTime
are timezone aware. For example, comparisons are done by comparing the same instant of time in UTC or within the same timezone. Despite having timezone support, the chrono
crate does not do this. Which can lead to surprising behaviour.
Since timezone information can be a bit heavy on resources and not something every application wants to concern itself with, the IANA database backed TimeZone
implementation is in another crate, eos-tz
. The base library only has Utc
and UtcOffset
for their concrete timezone implementations.
eos
supports no_std
targets and some optional features.
Default features:
alloc
: Enable features that require allocation.macros
: Enables the compile-time construction macros. Most of these usemacro_rules!
rather than the proc-macro machinery to keep compile times sane. Unfortunately, due to limitations inconst fn
, theformat_spec!
macro uses proc-macro machinery. To keep compile-times sane for this macro,syn
andquote
are not used.std
: Enable features that require the standard library. Impliesalloc
.formatting
: Enable features relating to formatting various types. Impliesalloc
.parsing
: Enable features relating to parsing strings to various types. Impliesalloc
.
Optional features:
serde
: Enable custom Serialize/Deserialize implementations. Requiresparsing
as well.rusqlite
: Enable implementations ofToSql
andFromSql
for the date and time types in the library. Requiresparsing
as well.
The design of this library was inspired by the following:
Certain algorithms come from one of these libraries above. Likewise, due to the difficult nature of testing datetimes, certain tests were adapted from one of these libraries as well to have better test coverage.
Without these libraries, this one would not be possible. eos
stands on the shoulder of giants.
This project is licensed under the Apache-2 license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in eos
by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.