Hello Nigel.
I can see that as clean approach; I just took what I got and by the help of Shane Stanley I got that right, the idea behind the setDate() was to not touch the time, of the passed object since it i might use it to calculate the same time 3 days from now.
I proposed a bug when saying use [b]setDate/b to set the initial date (removed) since the current time of the current date would have been retained.
I have written accompanying setTimeOfTheDay() and a setDateAndTime() handlers.
The two handler [b]setDate/b and [b]setTime/b still work as the previous one, as I will avoid creating new date objects that rather weird way of calling current date. Besides that; I can mutate time objects in place.
They are however not overly flexible, since I would have to make a copy of a date object I want to keep.
But: I can retain date and retain time whichever is the one I need.
setDateAndTime() Is another story since this sets all the parameters, so here I return a brand new date
based on current date to return a new date object.
I used the setDateAndTime() in the function xlTimeValueOfNow() in the post above to remove the proposed bug.
tell application "Quicksilver" to show large type "Thank You!"
on setTimeOfTheDay(int23Hour, int59Minuts, int59Seconds, dateObject)
set hours of dateObject to int23Hour
set minutes of dateObject to int59Minuts
set seconds of dateObject to int59Seconds
return dateObject
end setTime
on setDateAndTime(intYear, intMonth, intDay, int23Hour, int59Minutes, int59Seconds)
local dateObject
set dateObject to (current date)
set day of dateObject to 1 -- thanks to Shane Stanley
set year of dateObject to intYear
set month of dateObject to intMonth
set day of dateObject to intDay
set hours of dateObject to int23Hour
set minutes of dateObject to int59Minutes
set seconds of dateObject to int59Seconds
return dateObject
end setDateAndTime