Duration Calculation With FarsiLibrary
There’s a new date calculation in Farsi Library that might come in handy. The new function was added a few days ago and calculates date/time differences in a user friendly manner.
The usage is pretty straightforward. Take the following test as an example:
Some of the features of this function:
- It works for dates in future as well as dates in past
- Works with Gregorian Calendar as well as Persian Calendar
- Supports localization for fa-IR and neutral cultures out of the box.
The conversion works with different time units as small as Seconds and Minutes up to Decade, Centuries and Milleniums. It can optionally work with a reference date other than DateTime.Now so you can easily calculate any two date differences.
Originally FarsiLibrary project was started to facilitate working with Persian Calendar by providing date calculation functions and controls for Winform/WPF. The project was started back in .NET 1.1 timeframe with no PersianCalendar built-in the .NET Framework but even now, with multi-culture support for the controls and integration with other 3rd party controls, it solves many problems rather elegantly, even if I say so myself. It is an open-source project under MIT license.
This will be released in FarsiLibrary v3.0 but you can already take it for a spin and give me some feedback.