• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Daylight Saving bug in Numbers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Daylight Saving bug in Numbers


  • Subject: Re: Daylight Saving bug in Numbers
  • From: Yvan KOENIG <email@hidden>
  • Date: Wed, 30 Mar 2016 21:22:31 +0200


Le 30 mars 2016 à 19:41, HEB <email@hidden> a écrit :

There is clearly a Daylight Saving bug when communicating with Numbers. I don't know if this has been reported earlier or not, so I'll describe it here:

How to reproduce:

Preliminary: Assume you already have a spreadsheet file in Numbers open (version 3.6.1), and that the first cell in the first row is formatted as a date.
FYI: In Sweden we use international date format: YYYY-MM-DD.

tell application "Numbers"
tell table 1 of sheet 1 of front document
--Note: Daylight Saving Time started 2016-03-27
set value of cell 1 of row 1 to "2016-03-25"
return short date string of (get value of cell 1 of row 1)
end tell
end tell

--> "2016-03-24"

I.e, what I get back is a whole day earlier!!
In Numbers, the cell is "2016-03-25 00:00:00", i.e correct according to what I set it to. 
But when I get the date via AS then it is interpreted as one hour earlier, which means it becomes the day before.

If, on the other hand, I set the date after the start of sumertime, e.g "2016-03-28", then it behaves correctly.

We can see that it appears to be one hour difference between Numbers and Applescript if we set a date object directly with:
date "2016-03-25"
which in Swedish expands to: 
date "fredag 25 mars 2016 00:00:00"
We get:
tell application "Numbers"
tell table 1 of sheet 1 of front document
--Note: Daylight Saving Time started 2016-03-27
set value of cell 1 of row 1 to date "fredag 25 mars 2016 00:00:00"
return (get value of cell 1 of row 1) --In this case we get the complete date, including the exact time.
end tell
end tell

--> date "fredag 25 mars 2016 00:00:00"

I.e, it appears to work well know, but if we look into Numbers, the cell is now:
"2016-03-25 01:00:00"
I.e, it is one hour ahead! I did set it to midnight, but it became 1 o'clock in the morning!
If I do the same thing but on the 28 March, then it will remain midnight also in Numbers.

I know this problem for years but I'm tired to file reports with no result.
Enter the formula =""& A1 in cell C1 and run the script below.

tell application "Numbers"
tell table 1 of sheet 1 of front document
--Note: Daylight Saving Time started 2016-03-27
set value of cell 1 of row 1 to "2016-03-25"
--return short date string of (get value of cell 1 of row 1)
set xx to formula of cell "C1"
log xx (*= ""&A1*)
log (get value of cell "C1")
set formula of cell "D1" to "= " & quote & quote & "&A1"
--> error "Erreur dans Numbers : Il est impossible de régler formula of cell à \"= \\\"\\\"&A1\"." number -10006 from formula of cell
return value of cell "D1" -- ""
end tell
end tell

You will see that the given formula converts the date into a string which is correctly extracted.
I'm just puzzled by the fact that I don't retrieve the correct syntax to urge the script to insert the formula.
As you may see, my late attempt failed with error #-10006.


Yvan KOENIG running El Capitan 10.11.4 in French (VALLAURIS, France) mercredi 30 mars 2016 21:21:38



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Daylight Saving bug in Numbers (From: HEB <email@hidden>)

  • Prev by Date: Daylight Saving bug in Numbers
  • Next by Date: Re: Getting the date of the next or current recurrence of an iCal/Calendar event
  • Previous by thread: Daylight Saving bug in Numbers
  • Next by thread: Re: Daylight Saving bug in Numbers
  • Index(es):
    • Date
    • Thread