nigelm
unread,Mar 28, 2008, 10:55:42 AM3/28/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to OFTD
Definitely looks to me as though localisation is the problem.
So, having never played with AppleScript before (so be gentle in the
comments!), I tried changing the parsing function to this:-
on TDTimeStampToASDate(dateStr, applyOffset)
-- 2008-01-09 18:53:15
-- or 2008-03-29 11:59 pm
-- or 2008-03-29
set unAdjusted to current date -- where we start
set year of unAdjusted to (text 1 thru 4 of dateStr)
set month of unAdjusted to (text 6 thru 7 of dateStr)
set day of unAdjusted to (text 9 thru 10 of dateStr)
if length of dateStr ≥ 19 then
if text 18 thru 19 of dateStr = "pm" then
set time of unAdjusted to (((text 12 thru 13 of dateStr) * hours) +
((text 15 thru 16 of dateStr) * minutes) + (12 * hours))
else
set time of unAdjusted to (((text 12 thru 13 of dateStr) * hours) +
((text 15 thru 16 of dateStr) * minutes))
end if
else
set time of unAdjusted to 0
end if
if not applyOffset then
return unAdjusted
else
if (hours of unAdjusted) + (minutes of unAdjusted) = 0 then --no
time was set, don't adjust
return unAdjusted
else
return (unAdjusted + (timeOffset * hours))
end if
end if
end TDTimeStampToASDate
Additionally I needed modify this fragment in TDTask2OFTask (I pushed
the date through the parser rather than converting it in place)
set dateStr to TDcompleted of TaskData
--set mvTest to (item (TD_taskKey's TD_completed) of TaskData)
if dateStr is not false then
set completionDate to my TDTimeStampToASDate(dateStr, false)
set completed of thisTask to true
set completion date of thisTask to completionDate
else
set completed of thisTask to false
end if
set TDpriority to TDpriority of TaskData as number
if TDpriority is greater than 0 then
set flagged of thisTask to true
else
set flagged of thisTask to false
end if
Seems to work for me now....