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

Re: Date anomaly


  • Subject: Re: Date anomaly
  • From: Christopher Nebel <email@hidden>
  • Date: Thu, 13 Mar 2003 11:02:10 -0800

On Wednesday, March 12, 2003, at 07:32 PM, Deivy Petrescu wrote:

Chris, you said that "date d" isn't a date.
But, check this out:

<script>
set d to "1/1/1"
log class of date d --------> date
log date d -------------------> (*Monday, January 1, 2001 0:00:00*)
set k to date d
log class of k ----------------> date
try
(current date) - (date d)
on error e
e -----------------------> "Can't make date \"Monday, January 1, 2001 0:00:00\" into a number or date."
end try
<script>

Exchanging k with date d works.
I've had other times when I had to coerce a class into itself to make the script work. Hard to understand why this would happen some times. Thanks for any clarification.

"date d" is not, technically, a date -- it's an object specifier. However, in each of these cases except the last one, there's an implicit evaluation of the object specifier, so you get the obvious result. Yes, I know this is obscure. Object specifiers and references are supposed to always get evaluated implicitly when used in expressions *except* for "is" and "is not", and frankly, even that's debatable. There's a bug filed on the subtraction case.


--Chris Nebel
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Date anomaly (From: Deivy Petrescu <email@hidden>)

  • Prev by Date: Re: scripting mail to select mailboxes
  • Next by Date: Re: applescript in Mail.app
  • Previous by thread: Re: Date anomaly
  • Next by thread: Re: Date anomaly
  • Index(es):
    • Date
    • Thread