Fixed time zone offset which NSCalendar doesn't take into account
This commit is contained in:
parent
a382904015
commit
a4a70bbd32
|
@ -29,7 +29,10 @@ actual class Date(val date: NSDate) { // cannot subclass NSDate as it's a class
|
||||||
dateComponents.month = month.toLong()
|
dateComponents.month = month.toLong()
|
||||||
dateComponents.day = day.toLong()
|
dateComponents.day = day.toLong()
|
||||||
|
|
||||||
return NSCalendar.currentCalendar.dateFromComponents(dateComponents) !!
|
val calendar = NSCalendar.currentCalendar
|
||||||
|
val todayInUtc = calendar.dateFromComponents(dateComponents) !!
|
||||||
|
|
||||||
|
return calendar.dateByAddingUnit(NSCalendarUnitSecond, NSTimeZone.defaultTimeZone.secondsFromGMT, todayInUtc, 0)!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue