mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 09:32:55 +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[] { "48h120s" },
|
||||||
new object[] { "10y24M" },
|
new object[] { "10y24M" },
|
||||||
new object[] { "10y60d120s" },
|
new object[] { "10y60d120s" },
|
||||||
new object[] { "0.1y0.1M2d" },
|
new object[] { "0y0M2d" },
|
||||||
new object[] { "0.99y0.99M2d" }
|
new object[] { "1y1M2d" }
|
||||||
};
|
};
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -348,7 +348,9 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
new object[] { "7d7y" },
|
new object[] { "7d7y" },
|
||||||
new object[] { "0:3:6" },
|
new object[] { "0:3:6" },
|
||||||
new object[] { "0:3:" },
|
new object[] { "0:3:" },
|
||||||
new object[] { "\"three days\"" }
|
new object[] { "\"three days\"" },
|
||||||
|
new object[] { "0.1y0.1M2d" },
|
||||||
|
new object[] { "0.99y0.99M2d" }
|
||||||
};
|
};
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -419,13 +419,17 @@ namespace osu.Game.Screens.Select
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "months":
|
case "months":
|
||||||
dateTimeOffset = dateTimeOffset.AddMonths(-(int)Math.Floor(length));
|
if (match[key].Value.Contains('.'))
|
||||||
dateTimeOffset = dateTimeOffset.AddDays(-30 * (length - Math.Floor(length)));
|
return false;
|
||||||
|
|
||||||
|
dateTimeOffset = dateTimeOffset.AddMonths(-(int)length);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "years":
|
case "years":
|
||||||
dateTimeOffset = dateTimeOffset.AddYears(-(int)Math.Floor(length));
|
if (match[key].Value.Contains('.'))
|
||||||
dateTimeOffset = dateTimeOffset.AddDays(-365 * (length - Math.Floor(length)));
|
return false;
|
||||||
|
|
||||||
|
dateTimeOffset = dateTimeOffset.AddYears(-(int)length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user