cardigann: move check for Rfc1123ZPattern (#14095)

This commit is contained in:
Bogdan 2023-02-25 23:33:07 +02:00 committed by GitHub
parent a99093386a
commit 2a9702cad6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -2035,7 +2035,7 @@ namespace Jackett.Common.Indexers
value = release.Seeders.ToString(); value = release.Seeders.ToString();
break; break;
case "date": case "date":
release.PublishDate = DateTime.TryParseExact(value, DateTimeUtil.Rfc1123ZPattern, CultureInfo.InvariantCulture, DateTimeStyles.None, out var parsedDate) ? parsedDate : DateTimeUtil.FromUnknown(value); release.PublishDate = DateTimeUtil.FromUnknown(value);
value = release.PublishDate.ToString(DateTimeUtil.Rfc1123ZPattern, CultureInfo.InvariantCulture); value = release.PublishDate.ToString(DateTimeUtil.Rfc1123ZPattern, CultureInfo.InvariantCulture);
break; break;
case "files": case "files":

View File

@ -115,6 +115,10 @@ namespace Jackett.Common.Utils
try try
{ {
str = ParseUtil.NormalizeSpace(str); str = ParseUtil.NormalizeSpace(str);
if (DateTime.TryParseExact(str, Rfc1123ZPattern, CultureInfo.InvariantCulture, DateTimeStyles.None, out var parsedDate))
return parsedDate;
var now = relativeFrom ?? DateTime.Now; var now = relativeFrom ?? DateTime.Now;
// try parsing the str as an unix timestamp // try parsing the str as an unix timestamp