fix dateextension
This commit is contained in:
parent
b371717f89
commit
e6f2654d9c
1 changed files with 10 additions and 2 deletions
|
|
@ -126,7 +126,11 @@ namespace BMA.EHR.Domain.Extensions
|
||||||
if (currentDate.Day < date.Day)
|
if (currentDate.Day < date.Day)
|
||||||
{
|
{
|
||||||
months--;
|
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;
|
days = lastMonthDays - date.Day + currentDate.Day;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -141,7 +145,11 @@ namespace BMA.EHR.Domain.Extensions
|
||||||
if (currentDate.Day < date.Day)
|
if (currentDate.Day < date.Day)
|
||||||
{
|
{
|
||||||
months--;
|
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;
|
days = lastMonthDays - date.Day + currentDate.Day;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue