Applescript returning wrong month from Numbers
My Numbers table contains dates that are the the first of the month and I need to use the month name in a script. If Cell B2 contains a date, entered as "1 May 2019" without the quotes, the following AppleScript returns "April" rather than "May".
activate application "Numbers"
tell application "Numbers"
tell table 1 of sheet 1 of front document
tell row 2
set x to value of cell 2
set xx to month of x
end tell
end tell
end tell
Logging x shows that the actual date/time value in B2 is an hour before midnight
get value of cell 2 of row 2 of table 1 of sheet 1 of document 1
--> date "Tuesday, 30 April 2019 at 11:00:00 PM"
So I'm wondering why this is, and what is the best way to avoid the problem. Putting
set x to value of cell 2 as date
doesn't help.
MacBook Pro Retina