mirror of https://github.com/Jackett/Jackett
DateTimeUtils: add support for today/yesterday/tomorrow without time
This commit is contained in:
parent
9a3f113bf4
commit
55b5064e28
|
@ -85,6 +85,9 @@ namespace Jackett.Utils
|
||||||
|
|
||||||
public static TimeSpan ParseTimeSpan(string time)
|
public static TimeSpan ParseTimeSpan(string time)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(time))
|
||||||
|
return TimeSpan.Zero;
|
||||||
|
|
||||||
TimeSpan offset = TimeSpan.Zero;
|
TimeSpan offset = TimeSpan.Zero;
|
||||||
if (time.EndsWith("AM"))
|
if (time.EndsWith("AM"))
|
||||||
{
|
{
|
||||||
|
@ -122,9 +125,9 @@ namespace Jackett.Utils
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Regex timeAgoRegexp = new Regex(@"(?i)\bago", RegexOptions.Compiled);
|
public static Regex timeAgoRegexp = new Regex(@"(?i)\bago", RegexOptions.Compiled);
|
||||||
public static Regex todayRegexp = new Regex(@"(?i)\btoday([\s,]+|$)", RegexOptions.Compiled);
|
public static Regex todayRegexp = new Regex(@"(?i)\btoday([\s,]*|$)", RegexOptions.Compiled);
|
||||||
public static Regex tomorrowRegexp = new Regex(@"(?i)\btomorrow([\s,]+|$)", RegexOptions.Compiled);
|
public static Regex tomorrowRegexp = new Regex(@"(?i)\btomorrow([\s,]*|$)", RegexOptions.Compiled);
|
||||||
public static Regex yesterdayRegexp = new Regex(@"(?i)\byesterday([\s,]+|$)", RegexOptions.Compiled);
|
public static Regex yesterdayRegexp = new Regex(@"(?i)\byesterday([\s,]*|$)", RegexOptions.Compiled);
|
||||||
public static Regex missingYearRegexp = new Regex(@"^\d{1,2}-\d{1,2}\b", RegexOptions.Compiled);
|
public static Regex missingYearRegexp = new Regex(@"^\d{1,2}-\d{1,2}\b", RegexOptions.Compiled);
|
||||||
public static Regex missingYearRegexp2 = new Regex(@"^(\d{1,2}\s+\w{3})\s+(\d{1,2}\:\d{1,2}.*)$", RegexOptions.Compiled); // 1 Jan 10:30
|
public static Regex missingYearRegexp2 = new Regex(@"^(\d{1,2}\s+\w{3})\s+(\d{1,2}\:\d{1,2}.*)$", RegexOptions.Compiled); // 1 Jan 10:30
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue