All Projects → workshop-depot → Roozh

workshop-depot / Roozh

Licence: Apache-2.0 license
Roozh (means "day" in Kurdish) is a library for converting Persian dates to Gregorian dates and vice versa.

Programming Languages

C#
18002 projects
javascript
184084 projects - #8 most used programming language
java
68154 projects - #9 most used programming language
go
31211 projects - #10 most used programming language
Classic ASP
548 projects

Roozh

Roozh (means "day" in Kurdish) is a library for converting Persian dates to Gregorian dates and vice versa.

This algorithm is presented by KAZIMIERZ M. BORKOWSKI and can be found here (http://www.astro.uni.torun.pl/~kb/Papers/EMP/PersianC-EMP.htm) and it's publishing is authorized by it's author.

For dates after 1799-03-20 and before 2256-03-20, the output generated by this algorithm is the same as internal Persian calendar of .NET framework. But beyond this region, there is a one day difference. To decide which is correct I am working on a code which represents the algorithm introduced by Professor Ahmad Birashk. I'll include that code into this repository too. So far from tests by sampling especially over leap years, beyond the mentioned region .NET Persian calendar is different than both other algorithms - by Borkowski and Birashk; which means it is very possible that .NET Persian calendar provides wrong dates before 1799-03-21 and after 2256-03-19.

The code is provided in JavaScript, C# and Java. True story is, I've found this code among some of mine from 11 years ago from beta days of .NET!

But 456 years is a wide enough range to start using this code right now for daily usage. I do not know about you, but I highly doubt that if I could see 250 years from now!

Happy coding and feedbacks are welcome!

Usage

Currently it has just two methods persianToGregorian and gregorianToPersian which will return a JavaScript object in form of { year: 1392, month: 10, day: 11 }.

For example:

var persian = Roozh.gregorianToPersian(year, month, day);

$("#persianYear").val(persian.year);
$("#persianMonth").val(persian.month);
$("#persianDay").val(persian.day);

C# and Java versions are pretty much the same just with PascalCasing!

Version

0.0.1 alpha (but core algorithm is correct, just needs some tools around the core)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].