hijrah-date | Javascript date in the Hijrah calendar system | Date Time Utils library
kandi X-RAY | hijrah-date Summary
kandi X-RAY | hijrah-date Summary
Javascript date in the Hijrah calendar system.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- initial setup
- Convert a locale string into a date format .
- Formats a number into the given number .
- Rounds a number to the specified number
- Parses a number into an array of digits .
- Hiday date constructor .
- Loop over an object
- Calculates the gregorian date from epoch .
- Creates and initial epochs for the given range .
- convert json string to date
hijrah-date Key Features
hijrah-date Examples and Code Snippets
Community Discussions
Trending Discussions on hijrah-date
QUESTION
Hello I'm trying to convert JS library into TypeScript.
Link to library: https://github.com/msarhan/hijrah-date
I found it difficult to convert main function into class. I don't understand the part that why HijrahDate
has a HijrahDate
function in it ? Is it old way of creating constructor ?
What I'm trying to achieve is to convert (if possible) old JS code into Typescript class.
Simplified version
...ANSWER
Answered 2021-Mar-27 at 15:41The javascript implementation generates the class through an IIFE, which effectively provides a pattern for generating a 'private' API without prior native support. The init
function itself could be considered part of the private API. While invoked, it's never actually exposed on the returned class. Further, init
relies on certain private vars such as maxEpochDay
which you have not declared.
Any function or variable not ultimately exposed on the returned class via the IIFE could be declared private with ts. Those which are defined on the prototype property in the IIFE could be included be added as class methods, which are public by default or can be marked for clarity.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install hijrah-date
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page