Skip to content
This repository has been archived by the owner on May 10, 2020. It is now read-only.
/ Roozh Public archive

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

License

Notifications You must be signed in to change notification settings

workshop-depot/Roozh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •