Re: class reference "date" problems
Re: class reference "date" problems
- Subject: Re: class reference "date" problems
- From: has <email@hidden>
- Date: Sat, 09 May 2015 15:15:32 +0100
Nigel Garvey wrote:
> And even with AD dates, the day should additionally be set to a value
> below 29 before the month's set in order to avoid overflow into the
> following month when (current date)'s day number is higher than the
> number of days in the target month:
You're right, it should be this:
on makeDate(y, m, d, hr, min, sec)
set newDate to current date
set day of newDate to 1
tell newDate to set {its year, its month, its day, its time} to
{y, m, d, hr * hours + min * minutes + sec}
return newDate
end makeDate
I typed the code from memory instead of copying the correct version from
the Apress book (which does include this workaround). Having
subsequently defected to more capable languages for my own application
scripting work, I tend to forget just how rampantly broken the
AppleScript language itself (i.e. the non-application scripting parts)
really is.
Of course, this entire mess could easily be prevented if AppleScript's
`date <value>` specifier would just accept a record containing `year`,
`month`, `day`, and/or `time` properties, like this:
date {year:2015, month:5}
--> date "Friday, 1 May 2015 00:00:00"
Alas, the AS team enjoys adding defects far more than fixing them, so I
wouldn't advise holding your breath for such a simple improvement.
Though feel free to file it as a Radar feature request
(https://bugreport.apple.com/) if it's something you really care about
and don't have anything better to do.
has
_______________________________________________
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