mygulamali / mumineen_calendar_js

A Hijri calendar for Dawoodi Bohra Shia Muslims (again).
https://www.mumineencalendar.com
MIT License
22 stars 18 forks source link

Use this in my react native application. #2

Closed mustafa-taheri closed 3 years ago

mustafa-taheri commented 3 years ago

Hi @mygulamali Murtaza Bhai,

I want to use this is in my React Native Application. Is there an npm package available for this? How can I integrate this with my application? You can mark this as a question it's not an issue just an informative question.

mygulamali commented 3 years ago

Hi @mustafa-taheri,

Thanks for your interest in this project. I never created it with the intention to be a Node module so I'm afraid there isn't a npm package. But it was written in ReactJS so it should be straightforward for you to use the core code in a React Native app.

The code for the calendar conversion calculations is in the source/assets/javascripts/_lib directory. The ReactJS components are in the source/assets/javascripts/_components directory. They should be self explanatory, but please feel free to open another issue if you have any more questions.

I'm currently working on another version, which uses GatsbyJS instead of Middleman to generate the site. So hopefully a future version will have a package.json at least. 😬 Soon soon.

Thanks again!

mustafa-taheri commented 3 years ago

ThanQ for the response Bhai, I have seen the code but I got confused with so many things, The only thing I need from that this library is the Hijri Date and I know the hijri_date.js file will solve my problem. is there a way I can directly pass Georgian date to hijri.fromGeorgian() in my component. Basically this is what I am trying to achieve.

Screenshot from 2020-08-18 02-28-19

mustafa-taheri commented 3 years ago

@mygulamali Murataza Bhai, any suggestions..??

mygulamali commented 3 years ago

HI @mustafa-taheri, you should be able to pass a regular JS Date object to HijriDate.gregorianToAJD to convert it into an Astronomical Julian Date (AJD). The AJD can then be converted into a HijriDate object using the HijriDate.fromAJD method. This is essentially what the fromGregorian method does (see here).

mustafa-taheri commented 3 years ago

Shukran @mygulamali Bhai, Your library is very helpful I have solved the issue and that fulfilled my purpose... ThanQ again.. Closing this issue.

Happy Coding Bhai...