Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions di/k4unit/k4unit.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ q)k4unit:use`di.k4unit

Then run the module test function to run the tests on another module, example:
```q
q)k4unit.moduletest`di.timezone
q)k4unit.moduletest`di.tz
```

As part of the test cases it rquires the "before" test to module load the module with the same naming convention used for the tests, in this case "timezone":
As part of the test cases it requires the "before" test to module load the module with the same naming convention used for the tests, in this case "tz":
```
before,0,0,q,timezone:use`di.timezone,1,,Initialize module
true,0,0,q,2025.07.22D14:19:48.386221575=timezone.localtogmt[`$"America/New_York";2025.07.22D10:19:48.386221575],1,,Test local to gmt 1
before,0,0,q,timezone:use`di.tz,1,,Initialize module
true,0,0,q,2025.07.22D14:19:48.386221575=tz.localtogmt[`$"America/New_York";2025.07.22D10:19:48.386221575],1,,Test local to gmt 1
```

---
Expand All @@ -40,19 +40,19 @@ q)k4unit.saveresults`:path/to/output.csv
q)k4unit.loadresults`:path/to/output.csv
action ms bytes lang code ..
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------..
true 0 0 q 2025.07.22D14:19:48.386221575=timezone.localtogmt[`$"America/New_York";2025.07.22D10:19:48.386221575] ..
true 0 0 q 1999.03.03D12:13:48.919241092=timezone.localtogmt[`$"Europe/London";1999.03.03D12:13:48.919241092] ..
true 0 0 q 1967.05.02D21:03:52.857237462=timezone.gmttolocal[`$"America/Toronto";1967.05.03D01:03:52.857237462] ..
true 0 0 q 2017.09.01D04:03:52.857237462=timezone.gmttolocal[`$"America/Los_Angeles";2017.09.01D11:03:52.857237462] ..
true 0 0 q 2025.07.21D19:19:48.386221575=timezone.convert[`$"Asia/Singapore";`$"America/Vancouver";2025.07.22D10:19:48.386221575] ..
true 0 0 q 2025.07.24D15:27:58.224707599=timezone.convert[`$"America/New_York";`$"America/Toronto";2025.07.24D15:27:58.224707599] ..
true 0 0 q 2025.11.02D01:30:00.000=timezone.convert[`$"America/New_York";`$"America/New_York";2025.11.02D01:30:00.000] ..
true 0 0 q (2025.08.03D22:50:46.515073740;2025.08.04D22:50:46.515073740;2025.08.05D22:50:46.515073740)~timezone.localtogmt[`$"America/Toronto";(2025.08.03D18:50:46.51507..
true 0 0 q (2025.08.03D11:50:46.515073740;2025.08.04D11:50:46.515073740;2025.08.05D11:50:46.515073740)~timezone.gmttolocal[`$"America/Vancouver";(2025.08.03D18:50:46.515..
true 0 0 q (2025.08.05D19:50:46.515073740;2025.08.05D14:50:46.515073740)~timezone.gmttolocal[`$("Europe/London";"America/New_York");2# 2025.08.05D18:50:46.515073740] ..
true 0 0 q (2025.08.05D17:50:46.515073740;2025.08.05D22:50:46.515073740)~timezone.localtogmt[`$("Europe/London";"America/New_York");2# 2025.08.05D18:50:46.515073740] ..
true 0 0 q `notValidTimezone~.[timezone.gmttolocal;(`testTimezone;.z.p);{`$x}] ..
true 0 0 q `notValidTimezone~.[timezone.localtogmt;(`testTimezone;.z.p);{`$x}]
true 0 0 q 2025.07.22D14:19:48.386221575=tz.localtogmt[`$"America/New_York";2025.07.22D10:19:48.386221575] ..
true 0 0 q 1999.03.03D12:13:48.919241092=tz.localtogmt[`$"Europe/London";1999.03.03D12:13:48.919241092] ..
true 0 0 q 1967.05.02D21:03:52.857237462=tz.gmttolocal[`$"America/Toronto";1967.05.03D01:03:52.857237462] ..
true 0 0 q 2017.09.01D04:03:52.857237462=tz.gmttolocal[`$"America/Los_Angeles";2017.09.01D11:03:52.857237462] ..
true 0 0 q 2025.07.21D19:19:48.386221575=tz.convert[`$"Asia/Singapore";`$"America/Vancouver";2025.07.22D10:19:48.386221575] ..
true 0 0 q 2025.07.24D15:27:58.224707599=tz.convert[`$"America/New_York";`$"America/Toronto";2025.07.24D15:27:58.224707599] ..
true 0 0 q 2025.11.02D01:30:00.000=tz.convert[`$"America/New_York";`$"America/New_York";2025.11.02D01:30:00.000] ..
true 0 0 q (2025.08.03D22:50:46.515073740;2025.08.04D22:50:46.515073740;2025.08.05D22:50:46.515073740)~tz.localtogmt[`$"America/Toronto";(2025.08.03D18:50:46.51507 ..
true 0 0 q (2025.08.03D11:50:46.515073740;2025.08.04D11:50:46.515073740;2025.08.05D11:50:46.515073740)~tz.gmttolocal[`$"America/Vancouver";(2025.08.03D18:50:46.515 ..
true 0 0 q (2025.08.05D19:50:46.515073740;2025.08.05D14:50:46.515073740)~tz.gmttolocal[`$("Europe/London";"America/New_York");2# 2025.08.05D18:50:46.515073740] ..
true 0 0 q (2025.08.05D17:50:46.515073740;2025.08.05D22:50:46.515073740)~tz.localtogmt[`$("Europe/London";"America/New_York");2# 2025.08.05D18:50:46.515073740] ..
true 0 0 q `notValidTimezone~.[tz.gmttolocal;(`testTimezone;.z.p);{`$x}] ..
true 0 0 q `notValidTimezone~.[tz.localtogmt;(`testTimezone;.z.p);{`$x}] ..
```

### Configuration
Expand Down
18 changes: 0 additions & 18 deletions di/timezone/test.csv

This file was deleted.

File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions di/tz/test.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
action,ms,bytes,lang,code,repeat,minver,comment
before,0,0,q,tz:use`di.tz,1,,Initialize module

true,0,0,q,2025.07.22D14:19:48.386221575=tz.localtogmt[`$"America/New_York";2025.07.22D10:19:48.386221575],1,,Test local to gmt 1
true,0,0,q,1999.03.03D12:13:48.919241092=tz.localtogmt[`$"Europe/London";1999.03.03D12:13:48.919241092],1,,Test local to gmt 2
true,0,0,q,1967.05.02D21:03:52.857237462=tz.gmttolocal[`$"America/Toronto";1967.05.03D01:03:52.857237462],1,,Test gmt to local 1
true,0,0,q,2017.09.01D04:03:52.857237462=tz.gmttolocal[`$"America/Los_Angeles";2017.09.01D11:03:52.857237462],1,,Test gmt to local 2
true,0,0,q,2025.07.21D19:19:48.386221575=tz.convert[`$"Asia/Singapore";`$"America/Vancouver";2025.07.22D10:19:48.386221575],1,,Test timezone to timezone 1
true,0,0,q,2025.07.24D15:27:58.224707599=tz.convert[`$"America/New_York";`$"America/Toronto";2025.07.24D15:27:58.224707599],1,,Test timezone to timezone 2
true,0,0,q,2025.11.02D01:30:00.000=tz.convert[`$"America/New_York";`$"America/New_York";2025.11.02D01:30:00.000],1,,DST edge case

true,0,0,q,(2025.08.03D22:50:46.515073740;2025.08.04D22:50:46.515073740;2025.08.05D22:50:46.515073740)~tz.localtogmt[`$"America/Toronto";(2025.08.03D18:50:46.515073740;2025.08.04D18:50:46.515073740;2025.08.05D18:50:46.515073740)],1,,Test single timezone multi ts 1
true,0,0,q,(2025.08.03D11:50:46.515073740;2025.08.04D11:50:46.515073740;2025.08.05D11:50:46.515073740)~tz.gmttolocal[`$"America/Vancouver";(2025.08.03D18:50:46.515073740;2025.08.04D18:50:46.515073740;2025.08.05D18:50:46.515073740)],1,,Test single timezone multi ts 2
true,0,0,q,(2025.08.05D19:50:46.515073740;2025.08.05D14:50:46.515073740)~tz.gmttolocal[`$("Europe/London";"America/New_York");2# 2025.08.05D18:50:46.515073740],1,,Test multi timezones multi ts 1
true,0,0,q,(2025.08.05D17:50:46.515073740;2025.08.05D22:50:46.515073740)~tz.localtogmt[`$("Europe/London";"America/New_York");2# 2025.08.05D18:50:46.515073740],1,,Test multi timezones multi ts 2

true,0,0,q,`notValidTimezone~.[tz.gmttolocal;(`testTimezone;.z.p);{`$x}],1,,Test error catch for invalid timezone 1
true,0,0,q,`notValidTimezone~.[tz.localtogmt;(`testTimezone;.z.p);{`$x}],1,,Test error catch for invalid timezone 2
6 changes: 3 additions & 3 deletions di/timezone/timezone.md → di/tz/tz.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This project provides utilities to manage and convert timestamps across timezone
Timezone reference data is sourced from https://timezonedb.com/download and must be downloaded and provided to the module in order to function.
The downloadable .zip archive includes several files, but only time_zone.csv is used for core functionality.

There is a copy of tzinfo already in the module default subdirectory : timezone/config/tzinfo.
There is a copy of tzinfo already in the module default subdirectory : tz/config/tzinfo.
Should you need to update can follow the steps below.

Following transformations to save down and be formatted for the module:
Expand All @@ -26,14 +26,14 @@ t:flip `timezoneID`gmtDateTime`gmtOffset`dst!("S JIB";csv)0:hsym `:time_zone.cs
Loading the module will automatically initialise using the included tzinfo.

```q
q)tz:use`di.timezone
q)tz:use`di.tz
```

If you wish to use an alternative tzinfo file, you can call the init function with
the path to your file

```q
q)tz:use`di.timezone
q)tz:use`di.tz
q)tz.init "path/to/tzinfo"
```

Expand Down