Closed amarbibek closed 4 years ago
Issue-Label Bot is automatically applying the label bug
to this issue, with a confidence of 0.98. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Hi @amarbibek, Sorry for the late reply.
The constructor is as follows:
NepaliDate(year: number, monthIndex: number, date: number)
You are passing in date for the month of Ashwin whose month index is 5. So, it is showing the date of next month. For Bhadra, the index is 4. The month index is expected in this constructor. This is done to make it consistent with the existing javascript Date library which uses the same approach.
Reference from the doc: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date
Here are the constructor docs: https://subeshb1.github.io/Nepali-Date/classes/nepalidate.html
Closing this as a duplicate of https://github.com/subeshb1/Nepali-Date/issues/25
Feel free to re-open ore create another issue if your queries are not met.
Thanks for the response.
I could figure that out. My actual concern is the day of the week, "०८, आश्विन २०७७" was "सोमबार " not "बिहिबार".
For Bhadra:
For Ashwin:
The weekday is Thursday for Ashwin 8, 2077
:
Is it not right? Do let me know. Thanks!
@amarbibek
I see. It got messed up because of month. Thank you very much.
It is giving the wrong day of the week .
let a = new NepaliDate(2077,05,08);
a.format('ddd DD, MMMM YYYY', 'np') // "बिहिबार ०८, आश्विन २०७७" <-- output
// "सोमबार ०८, भाद्र २०७७" <-- Actual Date in Nepali