diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-01-29 18:15:42 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-01-29 18:15:42 -0500 |
commit | 3431f486a2ef93e86d8923c1a4651644110df81b (patch) | |
tree | 8920ca74486930f3841666206acd1b992040cebf /src/SMAPI/Utilities/SDate.cs | |
parent | 6dd4a8a12b25d349b18609132dade14da6ec3cf9 (diff) | |
download | SMAPI-3431f486a2ef93e86d8923c1a4651644110df81b.tar.gz SMAPI-3431f486a2ef93e86d8923c1a4651644110df81b.tar.bz2 SMAPI-3431f486a2ef93e86d8923c1a4651644110df81b.zip |
normalize season names in SDate constructor
Diffstat (limited to 'src/SMAPI/Utilities/SDate.cs')
-rw-r--r-- | src/SMAPI/Utilities/SDate.cs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/SMAPI/Utilities/SDate.cs b/src/SMAPI/Utilities/SDate.cs index cd075dcc..e10a59f8 100644 --- a/src/SMAPI/Utilities/SDate.cs +++ b/src/SMAPI/Utilities/SDate.cs @@ -250,6 +250,8 @@ namespace StardewModdingAPI.Utilities /// <exception cref="ArgumentException">One of the arguments has an invalid value (like day 35).</exception> private SDate(int day, string season, int year, bool allowDayZero) { + season = season?.Trim().ToLowerInvariant(); + // validate if (season == null) throw new ArgumentNullException(nameof(season)); @@ -277,7 +279,7 @@ namespace StardewModdingAPI.Utilities /// <param name="year">The year.</param> private bool IsDayZero(int day, string season, int year) { - return day == 0 && season == "spring" && year == 1; + return day == 0 && season?.Trim().ToLower() == "spring" && year == 1; } /// <summary>Get the day of week for a given date.</summary> |