From 793717729ae46bd026eff882f7d4da819dec32e5 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 30 Sep 2024 01:53:39 -0400 Subject: Parameterize with timezones --- environment.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'environment.c') diff --git a/environment.c b/environment.c index 69710b41..d5b8190c 100644 --- a/environment.c +++ b/environment.c @@ -265,18 +265,20 @@ env_t *new_compilation_unit(CORD libname) // Used as a default for functions below: {"now", "DateTime$now", "func()->DateTime"}, - {"after", "DateTime$after", "func(dt:DateTime,seconds=0.0,minutes=0.0,hours=0.0,days=0,weeks=0,months=0,years=0,local_time=yes)->DateTime"}, - {"date", "DateTime$date", "func(dt:DateTime,local_time=yes)->Text"}, - {"format", "DateTime$format", "func(dt:DateTime,format=\"%Y-%m-%dT%H:%M:%S%z\",local_time=yes)->Text"}, + {"after", "DateTime$after", "func(dt:DateTime,seconds=0.0,minutes=0.0,hours=0.0,days=0,weeks=0,months=0,years=0,timezone=!Text)->DateTime"}, + {"date", "DateTime$date", "func(dt:DateTime,timezone=!Text)->Text"}, + {"format", "DateTime$format", "func(dt:DateTime,format=\"%Y-%m-%dT%H:%M:%S%z\",timezone=!Text)->Text"}, {"from_unix_timestamp", "DateTime$from_unix_timestamp", "func(timestamp:Int64)->DateTime"}, - {"get", "DateTime$get", "func(dt:DateTime,year=!&Int,month=!&Int,day=!&Int,hour=!&Int,minute=!&Int,second=!&Int,nanosecond=!&Int,weekday=!&Int, local_time=yes)"}, + {"get", "DateTime$get", "func(dt:DateTime,year=!&Int,month=!&Int,day=!&Int,hour=!&Int,minute=!&Int,second=!&Int,nanosecond=!&Int,weekday=!&Int, timezone=!Text)"}, + {"get_local_timezone", "DateTime$get_local_timezone", "func()->Text"}, {"hours_till", "DateTime$hours_till", "func(now:DateTime,then:DateTime)->Num"}, {"minutes_till", "DateTime$minutes_till", "func(now:DateTime,then:DateTime)->Num"}, - {"new", "DateTime$new", "func(year:Int,month:Int,day:Int,hour=0,minute=0,second=0.0)->DateTime"}, + {"new", "DateTime$new", "func(year:Int,month:Int,day:Int,hour=0,minute=0,second=0.0,timezone=!Text)->DateTime"}, {"parse", "DateTime$parse", "func(text:Text, format=\"%Y-%m-%dT%H:%M:%S%z\")->DateTime?"}, - {"relative", "DateTime$relative", "func(dt:DateTime,relative_to=DateTime.now(),local_time=yes)->Text"}, + {"relative", "DateTime$relative", "func(dt:DateTime,relative_to=DateTime.now(),timezone=!Text)->Text"}, {"seconds_till", "DateTime$seconds_till", "func(now:DateTime,then:DateTime)->Num"}, - {"time", "DateTime$time", "func(dt:DateTime,seconds=no,am_pm=yes,local_time=yes)->Text"}, + {"set_local_timezone", "DateTime$set_local_timezone", "func(timezone=!Text)"}, + {"time", "DateTime$time", "func(dt:DateTime,seconds=no,am_pm=yes,timezone=!Text)->Text"}, {"unix_timestamp", "DateTime$unix_timestamp", "func(dt:DateTime)->Int64"}, )}, {"Path", Type(TextType, .lang="Path", .env=namespace_env(env, "Path")), "Text_t", "Text$info", TypedArray(ns_entry_t, -- cgit v1.2.3