Merge branch 'working' into develop

This commit is contained in:
Suphonchai Phoonsawat 2024-01-03 10:59:53 +07:00
commit 7dd51aa629

View file

@ -126,7 +126,11 @@ namespace BMA.EHR.Domain.Extensions
if (currentDate.Day < date.Day)
{
months--;
int lastMonthDays = DateTime.DaysInMonth(currentDate.Year, currentDate.Month - 1);
int lastMonthDays = 0;
if (currentDate.Month == 1)
lastMonthDays = DateTime.DaysInMonth(currentDate.Year - 1, 12);
else
lastMonthDays = DateTime.DaysInMonth(currentDate.Year, currentDate.Month - 1);
days = lastMonthDays - date.Day + currentDate.Day;
}
else
@ -141,7 +145,11 @@ namespace BMA.EHR.Domain.Extensions
if (currentDate.Day < date.Day)
{
months--;
int lastMonthDays = DateTime.DaysInMonth(currentDate.Year, currentDate.Month - 1);
int lastMonthDays = 0;
if (currentDate.Month == 1)
lastMonthDays = DateTime.DaysInMonth(currentDate.Year - 1, 12);
else
lastMonthDays = DateTime.DaysInMonth(currentDate.Year, currentDate.Month - 1);
days = lastMonthDays - date.Day + currentDate.Day;
}
else