npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

solarhijri-js

v1.0.0

Published

Converts Gregorian and SolarHijri calendars to each other

Downloads

107

Readme

SolarHijri JavaScript

A javascript functions for converting SolarHijri (Shamsi) and Gregorian calendar systems to each other based on Umm al-Qura Solar Hijri calculations.

About

SolarHijri calendar is solar Hijri calendar based on Umm al-Qura Solar Hijri calculations which has little different than the Iranian Jalali calculations.

Install

soon...

API

toSolarHijri(gy, gm, gd)

Converts a Gregorian date to SolarHijri.

solarHijri.toSolarHijri(2017, 9, 23) // { hy: 1396, hm: 1, hd: 1 }

toSolarHijri(date)

Converts a JavaScript Date object to SolarHijri.

solarHijri.toSolarHijri(new Date(2017, 9, 23)) // { hy: 1396, hm: 1, hd: 1 }

toGregorian(hy, hm, hd)

Converts a SolarHijri date to Gregorian.

solarHijri.toGregorian(1396, 1, 1) // { gy: 2017, gm: 9, gd: 23 }

isValidSolarHijriDate(hy, hm, hd)

Checks whether a SolarHijri date is valid or not.

solarHijri.isValidSolarHijriDate(1393, 1, 31) // false
solarHijri.isValidSolarHijriDate(1393, 1, 30) // true

isLeapSolarHijriYear(hy)

Is this a leap year or not?

solarHijri.isLeapSolarHijriYear(1393) // false
solarHijri.isLeapSolarHijriYear(1394) // true

solarHijriMonthLength(hy, hm)

Number of days in a given month in a SolarHijri year.

solarHijri.solarHijriMonthLength(1393, 1) // 30
solarHijri.solarHijriMonthLength(1395, 6) // 29

solarHijriCal(hy)

This function determines if the SolarHijri year is leap (366-day long) or is the common year (365 days), and finds the day in September (Gregorian calendar) of the first day of the SolarHijri year (hy).

solarHijri.solarHijriCal(1390) // { leap: true, gy: 2011, startDate: 23 }
solarHijri.solarHijriCal(1393) // { leap: false, gy: 2014, startDate: 23 }
solarHijri.solarHijriCal(1394) // { leap: true, gy: 2015, startDate: 23 }
solarHijri.solarHijriCal(1395) // { leap: false, gy: 2016, startDate: 23 }

h2j(hy, hm, hd)

Converts a date of the SolarHijri calendar to the Julian Day number.

solarHijri.h2j(1395, 1, 23) // 2457677

j2h(hdn)

Converts the Julian Day number to a date in the SolarHijri calendar.

solarHijri.j2h(2457490) // { hy: 1394, hm: 7, hd: 22 }

g2j(gy, gm, gd)

Calculates the Julian Day number from Gregorian or Julian calendar dates. This integer number corresponds to the noon of the date (i.e. 12 hours of Universal Time). The procedure was tested to be good since 1 March, -100100 (of both calendars) up to a few million years into the future.

solarHijri.g2j(2016, 4, 11) // 2457490

j2g(hdn)

Calculates Gregorian and Julian calendar dates from the Julian Day number (hdn) for the period since hdn=-34839655 (i.e. the year -100100 of both calendars) to some millions years ahead of the present.

solarHijri.j2g(2457490) // { gy: 2016, gm: 4, gd: 11 }

Acknowledgements

This project was built from the great work done by Jalali-js project.

License

MIT