• 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: Numbers Daylight Savings Bug Still Active?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Numbers Daylight Savings Bug Still Active?


  • Subject: Re: Numbers Daylight Savings Bug Still Active?
  • From: Shane Stanley <email@hidden>
  • Date: Tue, 07 Feb 2017 22:47:32 +1100

On 7 Feb 2017, at 2:40 pm, Christopher Stone <email@hidden> wrote:

Or is there a rational reason for this?

The word "rational" is probably far too strong, but it does look like a daylight savings issue. Perhaps Numbers is not storing the values as dates, and is doing it's own (mis)conversion. I'm guessing the value is out whenever the target date and the current date differ in terms of daylight savings.

Try this code. It requires 10.11 or later:

use AppleScript version "2.5"
use framework "Foundation"
use scripting additions

tell application "Numbers"
if document 1 exists then
tell document 1
tell active sheet
set activeTable to (the first table whose class of selection range is range)


tell activeTable
set cellRef to first cell of selection range
tell cellRef
set cellValue to value
set cellFormattedValue to formatted value
end tell
end tell


end tell
end tell
end if
end tell

set tz to current application's NSTimeZone's systemTimeZone()
set correctedValue to cellValue + (tz's daylightSavingTimeOffsetForDate:((current date) - (tz's daylightSavingTimeOffsetForDate:cellValue)))
{cellValue, correctedValue, cellFormattedValue}



-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


 _______________________________________________
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

  • Follow-Ups:
    • Re: Numbers Daylight Savings Bug Still Active?
      • From: Shane Stanley <email@hidden>
References: 
 >Numbers Daylight Savings Bug Still Active? (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Scripting Additions – Broken Bundles?
  • Next by Date: Re: The List is Finally Back Up!
  • Previous by thread: Re: Numbers Daylight Savings Bug Still Active?
  • Next by thread: Re: Numbers Daylight Savings Bug Still Active?
  • Index(es):
    • Date
    • Thread