Positive tests collected in the 11 days before daylight saving time started are not always detected as valid
Hi everyone
It looks like there's an issue with timezones while computing the validity of recovered positive tests. My guess is that it's due to the daylight saving time and that it offsets the results by 24h (a positive test is recognised as valid after 12 days instead of 11).
For an example, assuming you got tested positive on March 18 at 2pm and daylight saving time happened on March 27, it looks like the code is doing something like this (pseudoCode):
let samplingDate = "2022-03-18"
let samplingDateUTC = Date(dateString: samplingDate) // 2022-03-18T00:00:00 UTC
let samplingDateUTCEndOfDay = samplingDate.roundingToEndOfDay() // 2022-03-18T22:59:59 UTC
// At this point, minimumValidity is now pointing at March 30th because the time difference is now +2 and not +1
let minimumValidity = samplingDateUTCEndOfDay.dateByAddingDays(11) // 2022-03-29T22:59:59 UTC
// minimumValidityBeginningOfDay is still March 30
let minimumValidityBeginningOfDay = minimumValidity.roundingToBeginningOfDay() // 2022-03-29T22:00:00 UTC
// Assuming the check is done on March 29, 2pm
let today = Date() // 2022-03-29T14:00:00+0200
// The pass should be valid except it is not because minimumValidityBeginningOfDay points at March 30th
today >= minValidity // false here :-(
TBH, I'm not 100% sure what's happening and why the rounding is necessary but this is the furthest I could investigate. Running the same test on the Android App doesn't have the same issue, I'm guessing because it doesn't have this roundingToEndOfDay
Let me know if you need more details! Hope this helps,
Martin