eloyzone / jalali-calendar

A java Library that converts Gregorian to Jalali (or Jalali to Gregorian)
GNU Lesser General Public License v3.0
35 stars 4 forks source link

issues while converting gregorian to jalali #2

Closed Sepehr79 closed 3 years ago

Sepehr79 commented 3 years ago

Screenshot (128)

eloyzone commented 3 years ago

I am sorry my response is late,

Yes this issue happened because you are using the same DateConverter instance twice. First you used jalaliToGregorian and then gregorianToJalali.

A simple work-around is to create a new instance once you want to convert another date.

    DateConverter dateConverter1 = new DateConverter();
    LocalDate  localDate = dateConverter1.jalaliToGregorian(1400,1,8);

    DateConverter dateConverter2 = new DateConverter();
    JalaliDate jalaliDate = dateConverter2.gregorianToJalali(2021,3,28);

I know it seems ridiculous, but currently I am out of time and I hope to fix this issue in the near future.