mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
DateTimeUtils: add support for today/yesterday/tomorrow without time
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user