mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
Clarify datetime format in switch move error
This commit is contained in:
parent
942b620640
commit
1bd5e7e3ca
3 changed files with 24 additions and 16 deletions
|
|
@ -180,19 +180,21 @@ namespace PluralKit
|
|||
}
|
||||
}
|
||||
|
||||
// Then we try specific date+time combinations, both date first and time first
|
||||
// Then we try specific date+time combinations, both date first and time first, with and without commas
|
||||
foreach (var timePattern in timePatterns)
|
||||
{
|
||||
foreach (var datePattern in datePatterns)
|
||||
{
|
||||
var p1 = LocalDateTimePattern.CreateWithInvariantCulture($"{timePattern} {datePattern}").WithTemplateValue(midnight);
|
||||
var res1 = p1.Parse(str);
|
||||
if (res1.Success) return res1.Value.InZoneLeniently(zone);
|
||||
|
||||
|
||||
var p2 = LocalDateTimePattern.CreateWithInvariantCulture($"{datePattern} {timePattern}").WithTemplateValue(midnight);
|
||||
var res2 = p2.Parse(str);
|
||||
if (res2.Success) return res2.Value.InZoneLeniently(zone);
|
||||
foreach (var patternStr in new[]
|
||||
{
|
||||
$"{timePattern}, {datePattern}", $"{datePattern}, {timePattern}",
|
||||
$"{timePattern} {datePattern}", $"{datePattern} {timePattern}"
|
||||
})
|
||||
{
|
||||
var pattern = LocalDateTimePattern.CreateWithInvariantCulture(patternStr).WithTemplateValue(midnight);
|
||||
var res = pattern.Parse(str);
|
||||
if (res.Success) return res.Value.InZoneLeniently(zone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue