(phixonline)-->
with javascript_semantics
include timedate.e
constant days = 1, hours = 7,
fourdays = timedelta(days:=4),
-- fourdays = timedelta(0,4) -- equivalent, **NB** a plain '=' is a very different thing:
slipup = timedelta(days=4) -- === timedelta([weeks:=]iff(equal(days,4)?true:false))
-- with error if no local/in scope identifier days exists.
shift = timedelta(hours:=hours) -- perfectly valid (param hours:=local hours)
-- timedelta(0,hours:=15,3) -- illegal (not clear whether days:=3 or minutes:=3)
-- though of course the weeks:=0 part is fine
printf(1,"fourdays = %s\n",{elapsed(fourdays)})
printf(1,"wrong = %s\n",{elapsed(slipup)})
printf(1,"shift = %s\n",{elapsed(shift)})