Converting between Hijri and Gregorian

In a recent project, I needed to convert a date from Hijri (Um Alqura) to Gregoran and vice versa in Javascript. I looked into many open source libraries to accomplish this. However, these projects did not meet my needs; Either they would convert one way but not the other, or they would require an absurd amount of dependencies e.g. moment-hijri.

So, I tried to build and publish an NPM package that will do the conversion in a minimal way without providing any extra features like UI or date formatting/parsing. The package will expose two functions: toHijri, toGregorian. A code snippet is worth a thousand words 😊:

Links: NPM Package, Source Code.