mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 04:52:57 +08:00
Enforce integer value before y and M
Change impacted Tests
This commit is contained in:
parent
c2f225f025
commit
928145cdeb
@ -325,8 +325,8 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
||||
new object[] { "48h120s" },
|
||||
new object[] { "10y24M" },
|
||||
new object[] { "10y60d120s" },
|
||||
new object[] { "0.1y0.1M2d" },
|
||||
new object[] { "0.99y0.99M2d" }
|
||||
new object[] { "0y0M2d" },
|
||||
new object[] { "1y1M2d" }
|
||||
};
|
||||
|
||||
[Test]
|
||||
@ -348,7 +348,9 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
||||
new object[] { "7d7y" },
|
||||
new object[] { "0:3:6" },
|
||||
new object[] { "0:3:" },
|
||||
new object[] { "\"three days\"" }
|
||||
new object[] { "\"three days\"" },
|
||||
new object[] { "0.1y0.1M2d" },
|
||||
new object[] { "0.99y0.99M2d" }
|
||||
};
|
||||
|
||||
[Test]
|
||||
|
@ -419,13 +419,17 @@ namespace osu.Game.Screens.Select
|
||||
break;
|
||||
|
||||
case "months":
|
||||
dateTimeOffset = dateTimeOffset.AddMonths(-(int)Math.Floor(length));
|
||||
dateTimeOffset = dateTimeOffset.AddDays(-30 * (length - Math.Floor(length)));
|
||||
if (match[key].Value.Contains('.'))
|
||||
return false;
|
||||
|
||||
dateTimeOffset = dateTimeOffset.AddMonths(-(int)length);
|
||||
break;
|
||||
|
||||
case "years":
|
||||
dateTimeOffset = dateTimeOffset.AddYears(-(int)Math.Floor(length));
|
||||
dateTimeOffset = dateTimeOffset.AddDays(-365 * (length - Math.Floor(length)));
|
||||
if (match[key].Value.Contains('.'))
|
||||
return false;
|
||||
|
||||
dateTimeOffset = dateTimeOffset.AddYears(-(int)length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user