This commit is contained in:
2020-12-19 00:29:00 +00:00
parent 0a2ae1f992
commit d37f65ff6f
2 changed files with 136 additions and 47 deletions

View File

@@ -367,7 +367,24 @@ namespace AyaNova.PlugIn.V8
if (neverEmpty)
return DateTime.UtcNow.ToString("o");
return string.Empty;
}
///////////////////////////////
// v7 to v8 Date conversion
//
//
public static bool DateIsPast(object o, bool neverEmpty = false) { return DateIsPast(o.ToString(), neverEmpty); }
public static bool DateIsPast(string s, bool neverEmpty = false)
{
if (string.IsNullOrWhiteSpace(s))
return false;//no date so not past
DateTime result = new DateTime();
if (DateTime.TryParse(s, out result))
return result < DateTime.Now;
//can't parse so no, it's not past
return false;
}