-
Notifications
You must be signed in to change notification settings - Fork 5
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
typeLongDateTime suggested fix #5
Comments
@ronzo99 @hhas Just stumbled upon this bug, looking for a solution and found your old issue. Thank you for posting! I'd like to add to that that I've noticed yet another bug, related to time zones. As odd as it may seem, it seems to me that AppleScript returns a timestamp relative to the user's (or processes?) time zone and not in UTC. It feels quite wrong to do the following but maybe this is just a flaw in AppleScript/AppleEvents itself? So what I did is change the return statement to:
to account for the time zone offset already included in Isn't it possible for a macOS process to have a different time zone set than the system? If so, this code is going to break and I would have no idea how to convert it back to UTC. Edit: Just looked up the private implementation of |
Great sleuthing! I wonder if @hhas has abandoned this project now, like so many others? Either way, I’ve found his source code very instructive for coding my own AppleScript support. |
@ronzo99 Could you elaborate on why SwiftAutomation didn't meet your requirements and what your own code does better now? I'm considering using it for production code at the moment. |
@tobi-mb I was looking at it when I was thinking of converting some ObjC + ScriptingBridge automation code to Swift. I found Swift Automation worked as expected, but eventually decided not to rewrite my code in Swift. Good luck with your project! |
A couple of tweaks to handle AppleScript typeLongDateTime:
or alternatively modify existing case:
now that unpackAsDate has computed the TimeInterval delta, fix a bug in the return statement, changing + to -:
return Date(timeIntervalSinceReferenceDate: delta - epochDelta)
test with a folder on the desktop:
The text was updated successfully, but these errors were encountered: