Github GitHub - Jlobblet/Fugit: An F# library for syntactically nice constructio...
source link: https://github.com/Jlobblet/Fugit
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Fugit
An F# library for syntactically nice construction of DateTime and TimeSpan objects.
Tempus fugit.
Overview
Fugit provides functions that make code dealing with DateTime and TimeSpan objects nicer to work with.
oneDay |> ago 2 |> weeks |> before (January 23 2021) every oneHour |> since (5 |> hours |> ago) // Or, equivalently every oneHour |> in' (theLast (5 |> hours)) if input |> isAfter (52 |> weeks |> ago) then // Relative days of the week theThird Monday |> after (today())
Installation
Fugit is available on NuGet at https://www.nuget.org/packages/Fugit/.
Fugit.NodaTime is available on NuGet at https://www.nuget.org/packages/Fugit.NodaTime/.
Documentation
Proper documentation is in progress! In the meantime, most of the code is documented and fairly straightforward.
Differences between Fugit and Fugit.NodaTime
While I have strived my best to make the two libraries as similar as possible, there are a few differences:
- Some Fugit.NodaTime constructors use
int64
, whereas all Fugit constructors useint
- Fugit.NodaTime allows dependency injection on functions that rely on the current time, Fugit does not.
Contributing
Pull requests are very welcome! Code is formatted with Fantomas.
License
Fugit is licensed under the GPL-3.0 license. You can read it here.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK