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
let now: Date = Date()
let then: Date = now.adjust(second: 30)!
print("NOW: (now.toString(dateStyle: .full, timeStyle: .full)!)")
print("THEN: (then.toString(dateStyle: .full, timeStyle: .full)!)")
NOW: Sunday, March 12, 2023 at 11:42:48 AM Pacific Daylight Time
THEN: Sunday, March 12, 2023 at 11:42:30 AM Pacific Daylight Time
then is somehow 18 seconds BEHIND now. I understand neither the incorrect offset nor the negative time, but I strongly suspect that it has to do with today being a leap hour day (Spring forward in time).
if I instead do:
let then: Date = now + 30 // add 30 seconds
then all is as expected:
NOW: Sunday, March 12, 2023 at 11:50:08 AM Pacific Daylight Time
THEN: Sunday, March 12, 2023 at 11:50:38 AM Pacific Daylight Time
The text was updated successfully, but these errors were encountered:
let now: Date = Date()
let then: Date = now.adjust(second: 30)!
print("NOW: (now.toString(dateStyle: .full, timeStyle: .full)!)")
print("THEN: (then.toString(dateStyle: .full, timeStyle: .full)!)")
then is somehow 18 seconds BEHIND now. I understand neither the incorrect offset nor the negative time, but I strongly suspect that it has to do with today being a leap hour day (Spring forward in time).
if I instead do:
let then: Date = now + 30 // add 30 seconds
then all is as expected:
The text was updated successfully, but these errors were encountered: