Add single day tolerance to end of appearance period

This commit is contained in:
Kurt 2020-11-16 15:41:39 -08:00
parent 26e0f31c95
commit e6a60ec210

View file

@ -44,11 +44,15 @@ namespace PKHeX.Core
public bool IsWithinStartEnd(int stamp)
{
// Events are in UTC, but time zones exist (and delayed captures too).
// Allow an extra day past the end date.
const int tolerance = 1;
if (End == 0)
return Start <= stamp;
if (Start == 0)
return stamp <= End;
return Start <= stamp && stamp <= End;
return stamp <= End + tolerance;
return Start <= stamp && stamp <= End + tolerance;
}
public static int GetTimeStamp(int y, int m, int d) => (y << 16) | (m << 8) | d;