Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for devanagari date string while parsing #77

Open
aj3sh opened this issue Feb 1, 2024 · 2 comments
Open

Add support for devanagari date string while parsing #77

aj3sh opened this issue Feb 1, 2024 · 2 comments

Comments

@aj3sh
Copy link
Member

aj3sh commented Feb 1, 2024

This feature allows us to take input from Devanagari strings such as "२०७८-०१-१८" into the NepaliDate object. The current parse module should handle the Devanagari string so that the NepaliDate object can be initialized from such class.

const nepaliDate = new NepaliDate("२०७८-०१-१८")

The steps for parsing are like below:

  1. The input (can be both English or Devanagari string)
  2. Translate the Devanagari date strings to English strings. Translation includes numbers, months, and months abbrs.
  3. Use the translated English string for parsing.
@binodnepali
Copy link
Member

In my opinion, we should stick to how native js date initialisation works.

@aj3sh
Copy link
Member Author

aj3sh commented Mar 9, 2024

@binodnepali, Thanks for sharing your thoughts. We are adding this feature because we already have a method for formatting in Nepali (.formatNepali), and now we need one for parsing it. Other Nepali date tools are also considering or already have this feature.

If we want to keep initialization simple, we could add a static method like parseNepali(...), which acts as the opposite of formatNepali.

Let's also wait for others' opinions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants