I was just digging through some JavaScript code (Raphaël.js) and came across the following line (translated slightly):
Math.min.apply(0, x)
Here is an example where we can get the MAX and MIN timezone offsets for the given year for a timezone. It returns the two changes for the year to account for DST and ST. (i.e. ST = 300 an DST = 360 for the timezone in question).
var arr = [];
for (var i = 0; i < 365; i++) {
var d = new Date();
d.setDate(i);
var newoffset = d.getTimezoneOffset();
arr.push(newoffset);
}
var DST = Math.min.apply(null, arr);
var nonDST = Math.max.apply(null, arr);
tw.local.stInt = DST
tw.local.edInt = nonDST