fix 修改区间判断
This commit is contained in:
@@ -15,17 +15,20 @@ public static class TimePeriodExtensions
|
||||
|
||||
if (period.IsCrossDay())
|
||||
{
|
||||
//第二天
|
||||
if (dateTime.Hour >= 0)
|
||||
{
|
||||
start = DateTime.Today.AddDays(-1).Add(period.Start.Value.ToTimeSpan());
|
||||
end = DateTime.Today.Add(period.End.Value.ToTimeSpan());
|
||||
}
|
||||
else
|
||||
var currentStart = DateTime.Today.Add(period.Start.Value.ToTimeSpan());
|
||||
var endOfDay = DateTime.Today.AddHours(23).AddMinutes(59).AddSeconds(59);
|
||||
|
||||
if (dateTime >= currentStart && dateTime <= endOfDay)
|
||||
{
|
||||
start = DateTime.Today.Add(period.Start.Value.ToTimeSpan());
|
||||
end = DateTime.Today.AddDays(1).Add(period.End.Value.ToTimeSpan());
|
||||
}
|
||||
else
|
||||
{
|
||||
//第二天
|
||||
start = DateTime.Today.AddDays(-1).Add(period.Start.Value.ToTimeSpan());
|
||||
end = DateTime.Today.Add(period.End.Value.ToTimeSpan());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user