This repository has been archived on 2023-02-02. You can view files and clone it, but cannot push or open issues or pull requests.
mfgames-nitride-cil/src/MfGames.Nitride.Temporal.Schedules/TimeSpanHelper.cs
D. Moonfire 82e1bc3c28
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
feat(schedules)!: reworked schedule names and added a new style
2023-01-20 23:28:41 -06:00

36 lines
773 B
C#

using System;
using TimeSpanParserUtil;
namespace MfGames.Nitride.Temporal.Schedules;
public static class TimeSpanHelper
{
public static TimeSpan? Parse(string? input)
{
if (string.IsNullOrWhiteSpace(input))
{
return null;
}
if (input.Equals(
"immediate",
StringComparison.InvariantCultureIgnoreCase)
|| input.Equals(
"instant",
StringComparison.InvariantCultureIgnoreCase))
{
return TimeSpan.Zero;
}
if (input.Equals(
"never",
StringComparison.InvariantCultureIgnoreCase))
{
return null;
}
return TimeSpanParser.Parse(input);
}
}