0

I'm working with the Moment.js library on a project that involves the Jalali (Persian) calendar. I'm trying to compare dates in the Jalali calendar using Moment.js, but I'm encountering unexpected results. Specifically, the isSameOrAfter() method doesn't seem to be working as expected for certain cases.

Here's an example code snippet that demonstrates the issue:

const result = moment('1402-02-30', 'jYYYY-jM-jD').isSameOrAfter('1402-02-30');
console.log(result); // Returns false, but expected true

In the Jalali calendar, '1402-02-30' is a valid date. However, the comparison using isSameOrAfter() doesn't yield the expected result.

I've tried using the startOf('day') method to ensure the comparison only considers the date component, but it still returns false.

Could someone please help me understand why the comparison is not working as expected in the Jalali calendar and provide guidance on how to correctly compare dates in the Jalali calendar using Moment.js?

Vala Khosravi
  • 2,352
  • 3
  • 22
  • 49

0 Answers0