9c2149d52c
Disable edit button for past month Format gas correctly
27 lines
674 B
C#
27 lines
674 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
namespace MileageTraker.Web.Models
|
|
{
|
|
public static class DomainRules
|
|
{
|
|
/// <summary>
|
|
/// Returns the most recent date for which a log can be submitted from today
|
|
/// </summary>
|
|
public static DateTime GetLogEntryCutoff()
|
|
{
|
|
return GetLogEntryCutoff(DateTime.Today);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the most recent date for which a log can be submitted given the
|
|
/// reference date
|
|
/// </summary>
|
|
public static DateTime GetLogEntryCutoff(DateTime referenceDate)
|
|
{
|
|
return referenceDate.AddMonths(-1).AddDays(-referenceDate.Day + 1); // last two months
|
|
}
|
|
}
|
|
} |