MCPcopy Index your code
hub / github.com/expr-lang/expr / TestWithTimezone_date

Function TestWithTimezone_date

patcher/with_timezone_test.go:12–19  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestWithTimezone_date(t *testing.T) {
13 program, err := expr.Compile(`date("2024-05-07 23:00:00")`, expr.Timezone("Europe/Zurich"))
14 require.NoError(t, err)
15
16 out, err := expr.Run(program, nil)
17 require.NoError(t, err)
18 require.Equal(t, "2024-05-07T23:00:00+02:00", out.(time.Time).Format(time.RFC3339))
19}
20
21func TestWithTimezone_now(t *testing.T) {
22 program, err := expr.Compile(`now()`, expr.Timezone("Asia/Kamchatka"))

Callers

nothing calls this directly

Calls 6

CompileFunction · 0.92
TimezoneFunction · 0.92
NoErrorFunction · 0.92
RunFunction · 0.92
EqualFunction · 0.92
FormatMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…