123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566openFmlib_jsmoduleZone=structtypet=int(* offset in minutes from utc, westward positive, eastward
negative *)letutc:t=0letmake(minutes:int):t=minutesletoffset(zone:t):int=zoneendtypet=Date.tletzero:t=Date.of_value(0.0)letof_float(v:float):t=Date.of_valuevletto_float(t:t):float=Date.valuetletadapt(time:t)(zone:Zone.t):t=Date.(add(60000.*.float_of_int(zone_offsettime-zone))time)(* more westward is not yet that late *)letyear(time:t)(zone:Zone.t):int=Date.year(adapttimezone)letmonth(time:t)(zone:Zone.t):int=Date.month(adapttimezone)letday_of_month(time:t)(zone:Zone.t):int=Date.date(adapttimezone)lethour(time:t)(zone:Zone.t):int=Date.hours(adapttimezone)letminute(time:t)(zone:Zone.t):int=Date.minutes(adapttimezone)letsecond(time:t)(zone:Zone.t):int=Date.seconds(adapttimezone)letmilli_second(time:t)(zone:Zone.t):int=Date.milliseconds(adapttimezone)