// Return the number of days until this note is due in the user's timezone public int DaysUntilDue() { DateTime dueDateLocal = DueDate.ToLocalTime(User).Date; DateTime todayLocal = DateTime.UtcNow.ToLocalTime(User).Date; TimeSpan span = dueDateLocal.Subtract(todayLocal); int days = (int)span.TotalDays; return(days < 0 ? 0 : days); }
// Return true if due date has passed in user's timezone public bool IsOverdue() { return(DueDate.ToLocalTime(User).Date < DateTime.UtcNow.ToLocalTime(User).Date); }
// Return true if due date is today in user's timezone public bool IsDue() { return(DueDate.ToLocalTime(User).Date == DateTime.UtcNow.ToLocalTime(User).Date); }