You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using plain Date objects isInRange function ignores granularity parameters and always pass nanoseconds. This ends in a wrong result comparing dates.
For example the following check return false even if the passed granularity is day and both dates are in the same day.
letstartTime=Date(timeIntervalSince1970: 1538344800.0)// 2018-09-30 22:00:00 +0000letendTime=Date(timeIntervalSince1970: 1540940400.0 +(60*60*3))// 2018-10-31 02:00:00 +0000letcheckStart=Date(timeIntervalSince1970: 1540976400.0)// 2018-10-31 09:00:00 +0000letcheckLast=Date(timeIntervalSince1970: 1540978200.0)// 2018-10-31 09:30:00 +0000letisInside= checkStart.isInRange(date: startTime, and: endTime, orEqual: true, granularity:.day)// should return false even if its true
The text was updated successfully, but these errors were encountered:
Using plain Date objects
isInRange
function ignoresgranularity
parameters and always passnanoseconds
. This ends in a wrong result comparing dates.For example the following check return false even if the passed granularity is
day
and both dates are in the same day.The text was updated successfully, but these errors were encountered: