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
The below snippet of code works on OS X 10.11 El Capitan but not on an Ubuntu 14.04 Docker image with Swift 3.0 RELEASE installed or the October 2 snapshot. Tested in REPL as well as, originally, in a Vapor web application, where I was doing some Date manipulations.
The lower-case l should be the correct version so this probably needs to be changed here. In addition, there are optional-of-bool issues here; the 'comps.isLeapMonth' is a boolean value, which means it attempts to roll forward the leap month (which doesn't make sense). I think the error was introduced here, although it didn't help that the capitalisation was also wrong at the time:
Thanks Alex - I saw your response on the mailing list too, but for posterity's sake I'll re-post my reply here as well:
I came to the same conclusion, with one more minor bug (bringing the total to three): the definition of the date(byAdding:to:options: ) function itself was attempting to do math on CFAbsoluteTime 0.0, rather than the passed-in date's own timeIntervalSinceReferenceDate. I submitted a pull request to fix these issues last night here: #668
Your email address suggests you're with Apple; do you have the ability to review that PR and merge it in if it meets your specs? Our team kind of desperately needs this bug fix, as we can't do date math on our Swift-based server right now. Thanks!!
Environment
This code functions on OS X 10.11 but not in an Ubuntu 14.04 Docker image.
Here's the swift -version output on OS X 10.11:
And the swift -version output on the Ubuntu 14.04 Docker image:
Additional Detail from JIRA
md5: a9665d5c4946832d28b144569d47aae4
Issue Description:
The below snippet of code works on OS X 10.11 El Capitan but not on an Ubuntu 14.04 Docker image with Swift 3.0 RELEASE installed or the October 2 snapshot. Tested in REPL as well as, originally, in a Vapor web application, where I was doing some Date manipulations.
A few notes:
today is a valid Date object
Calendar.current is a valid Calendar object
I also tried manually checking that the date(from: DateComponents) function works, and it does:
The text was updated successfully, but these errors were encountered: