Closed HamedDN closed 1 year ago
Hi, there is not a problem :smiley: with this operation you will get Jalali(year, 12, 30) and since the last year is not a leap year, this is not a valid date and so it will throw an error
what do you want to achieve exactly ?
what do you want to achieve exactly ?
i want if the before month does not have the 30th day it give me the last day of the before month, Not "RageError"
this is not done automatically in shamsi_date library, but you can do something like this:
tmp = date.addMonth(-1);
newDate = tmp.withDay(tmp.monthLength)
is this working for you ? @HamedDN
or i think something like this will also work:
date.withDay(1) - 1
or equivalently
date.withDay(1).addDays(-1)
this is not done automatically in shamsi_date library, but you can do something like this:
tmp = date.addMonth(-1); newDate = tmp.withDay(tmp.monthLength)
is this working for you ? @HamedDN
yeah it work, i did this in my project, but it can be somthing that you add to your package.
there is a problem on
(dateProvider as Jalali).withDay(30).addMonths(-1)
when month is 1 and day is 30 or 31.