mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
fix: fixed time conversion
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
#nullable disable
|
using System.Text.RegularExpressions;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace NadekoBot.Common.TypeReaders.Models;
|
namespace NadekoBot.Common.TypeReaders.Models;
|
||||||
|
|
||||||
@@ -9,8 +8,8 @@ public class StoopidTime
|
|||||||
@"^(?:(?<months>\d)mo)?(?:(?<weeks>\d{1,2})w)?(?:(?<days>\d{1,2})d)?(?:(?<hours>\d{1,4})h)?(?:(?<minutes>\d{1,5})m)?(?:(?<seconds>\d{1,6})s)?$",
|
@"^(?:(?<months>\d)mo)?(?:(?<weeks>\d{1,2})w)?(?:(?<days>\d{1,2})d)?(?:(?<hours>\d{1,4})h)?(?:(?<minutes>\d{1,5})m)?(?:(?<seconds>\d{1,6})s)?$",
|
||||||
RegexOptions.Compiled | RegexOptions.Multiline);
|
RegexOptions.Compiled | RegexOptions.Multiline);
|
||||||
|
|
||||||
public string Input { get; set; }
|
public string Input { get; set; } = string.Empty;
|
||||||
public TimeSpan Time { get; set; }
|
public TimeSpan Time { get; set; } = default;
|
||||||
|
|
||||||
private StoopidTime() { }
|
private StoopidTime() { }
|
||||||
|
|
||||||
@@ -53,8 +52,8 @@ public class StoopidTime
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator TimeSpan(StoopidTime st)
|
public static implicit operator TimeSpan?(StoopidTime? st)
|
||||||
=> st.Time;
|
=> st?.Time;
|
||||||
|
|
||||||
public static implicit operator StoopidTime(TimeSpan ts)
|
public static implicit operator StoopidTime(TimeSpan ts)
|
||||||
=> new()
|
=> new()
|
||||||
|
Reference in New Issue
Block a user