The short Javascript function below provides the facilities to convert any of the five (5) Islamic (Hijri) Calendars' Dates ( from Islamic year -280,803 AH to +281,510 AH) into any of the following 18 Javascript Calendars with options for formatting the resulting output: The flowchart below summarises the concept of the Method which can be applied to convert other Calendars to the remaining Calendars. The method/code used here does not use external libraries and uses the Javascript Calendar Conversion by Target Approximation Method. For such purposes, you will need to use External Date Libraries to do the conversion such as 'moment.js' and many others. ![]() converting the 18 world calendar dates back into Gregorian Dates (including the Islamic Calendars Dates) or into other calendars. However, Javascript does not provide a built-in method for the reverse operation, i.e. We all know that Javascript has a built-in method ( the Intl.DateTimeFormat() ) to convert Gregorian Dates into various calendars' dates (18 World Calendars) including the formatting of the output string. Hope this post complies with StackOverflow Can I answer my own question? recommended policy guidelines for sharing new conceptual code with the community. Searching on both StackOverflow and CodeReview sites, the Method described in this Question/Post has not been attempted which is to convert the 5 Islamic Calendars' Dates to any of the 18 available calendars in Javascript without the use of External Date Libraries or using complex math/astronomical formulas.
0 Comments
Leave a Reply. |