• 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: Time anomaly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Time anomaly


  • Subject: Re: Time anomaly
  • From: Jon Pugh <email@hidden>
  • Date: Sun, 28 Oct 2012 10:01:47 -0700

On Oct 28, 2012, at 9:08 AM, Michelle Steiner wrote:
On Oct 28, 2012, at 8:29 AM, Thomas Fischer wrote:

I have to agree with Miguel, at least on my Snow Leopard system.
Calculations with months (or years) don't work as they do with days and weeks:

set myDate to the current date
set newDate to myDate + (371 * days)
log newDate
set newDate to myDate + (53 * weeks)
log newDate
set newDate to myDate + (12 * months)
log newDate
set newDate to myDate + (1 * year)
log newDate

works for days and weeks, but not for months  (actually already indicated by the colouring) and year (years is not a recognised term).
So I suppose it's some sort of bug in the date calculation part of AppleScript.

"days" is a constant equal to 86400, which is the number of seconds in a day.  "Day" is not used in this because it has another definition. (E.g., "day of (current date)")

Similarly "weeks" is a constant equal to 604800, the number of seconds in a week.

However, because the number of days in a month is not a constant, the number of seconds in a month can't be a constant, so "months" can't be a constant.  Similarly because the number of days in a year isn't a constant, "year" or "years" can't be a constant.

It was suggested to me that aside from the obvious “Don’t do that” recommendation, the proper solution to these issues is to file a bug.  It was speculatively considered that a probable solution would be to make AppleScript return a record of date/time elements, much as Cocoa does, which would allow you to modify those elements and then turn them back into a date, though I kind of like the idea of being able to just treat a date object’s properties as those elements, avoiding the whole “another data type” issue.

So, http://bugreport.apple.com if you are concerned enough to take action.  If enough bugs get filed, a case can be made to fix the problem.

Jon


 _______________________________________________
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: Time anomaly
      • From: Brian Christmas <email@hidden>
    • Re: Time anomaly
      • From: Shane Stanley <email@hidden>
References: 
 >Re: Time anomaly (From: Miguel Torikachvili <email@hidden>)
 >Re: Time anomaly (From: Ron Hunsinger <email@hidden>)
 >Re: Time anomaly (From: Thomas Fischer <email@hidden>)
 >Re: Time anomaly (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Time anomaly
  • Next by Date: Re: Time anomaly
  • Previous by thread: Re: Time anomaly
  • Next by thread: Re: Time anomaly
  • Index(es):
    • Date
    • Thread