Anyone have a script that takes a iso week...

and gives a Gregorian calendar date?

Hi,

maybe there’s a more elegant way, but this works


ISOweek_to_gregorian("2008-W10-4") -- returns a date

on ISOweek_to_gregorian(W)
	if W contains "W" then
		tell W to set {yr, wk, dy} to {text 1 thru 4, text 7 thru 8, text -1}
		tell (current date) to set refDate to it - (its time)
		tell refDate to set {its day, its month, its year} to {4, 1, yr}
		set wkday to (weekday of refDate as integer) - 1
		if wkday is 0 then set wkday to 7
		return (refDate - (wkday - 1) * days) + ((wk - 1) * weeks) + ((dy - 1) * days)
	else
		return false
	end if
end ISOweek_to_gregorian