//This method is used to get the difference of days from fromDate string and toDate string. public static int GetDifference(string fromDateString, string toDateString) { if (!(IsValidDateString(fromDateString) && IsValidDateString(toDateString))) { throw new Exception("Invalid Date"); } FromDate = new DateModel(fromDateString); ToDate = new DateModel(toDateString); var dateHelper = new DateHelper(FromDate, ToDate); return(dateHelper.GetDifference()); }
//This method is used to check if from date is less than to date public static bool IsFromDateLessThanToDate(string fromDateString, string toDateString) { if (!(IsValidDateString(fromDateString) && IsValidDateString(toDateString))) { throw new Exception("Invalid Date"); } FromDate = new DateModel(fromDateString); ToDate = new DateModel(toDateString); var dateHelper = new DateHelper(FromDate, ToDate); return(dateHelper.IsFromDateLessThanToDate()); }
public DateHelper(DateModel fromDate, DateModel toDate) { this.FromDate = fromDate; this.ToDate = toDate; }