-
Notifications
You must be signed in to change notification settings - Fork 113
Remove requirement for macOS 10.13 #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm a +1 on this and think that we should address it. @tomerd wdyt? |
+1 conceptually - I dont like the 10.13 constraint either. do we know if this can be done in all formats coming form AWS? I think foundation used ICU for some timezone localization aspects which may be more complicated than the one demonstrated here, but it may not be used here |
? It’s ISO, there are only really two variants, with ms and without |
Oh, timezones, this format doesn’t support timezones (anything locale bound requiring tzdata) , max gmt offsets, though it probably is Z always |
right, but IIRC there are other date formats we deal with in the library (unfortunately different AWS events have different date formats) so trying to understand if we can get away with this in all cases |
neither dateformatter nor locale require 10.13, it is just the specific isodateformatter, and iso is fixed |
works for me! |
@tomerd We can go full let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
formatter.timeZone = TimeZone(secondsFromGMT: 0)
formatter.locale = Locale(identifier: "en_US_POSIX")
return formatter |
date formatters are really really slow, i kicked them out of shrugs because they have been taking like 40% of the startup time. they are locale aware which is zarro necessary here |
i think strptime is fine, but the ms need to be handled separately |
ugh, looks like |
Issue #152 is fixed in the runtime: swift-server/swift-aws-lambda-runtime#152
The runtime requires macOS 10.13, which is quite inconvenient because all consuming packages now also need to explicitly require 10.13 in the package manifest. It is especially annoying if one tries to conditionally implement Lambda support in a 10.10 package via
#canImport
, e.g.: https://github.com/Macro-swift/Macro/blob/feature/lambda-1/Sources/http/Lambda/lambda.swift#L9Slack says this requirement only exists for the ISO date formatter, not sure whether you use it for rendering only or also for parsing. In any case, it should be quite easy to replace w/ a custom parser/renderer. Should be reasonable because the format is fixed and never changes.
It could be built on top of
timegm
andstrptime
, though it needs an extra processing step to capture the milliseconds:You could also provide this, and still use the ISO formatter if available (via
if #available(macOS 10.13, ...)
), which is what I do in Macro.The text was updated successfully, but these errors were encountered: