From 26ebaa302036f0ba8bd711c303d06f68f6d2d4d2 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Mon, 5 May 2025 08:35:59 +0800 Subject: [PATCH] Add system:tz() --- README.md | 2 ++ samples/tz-sample.lua | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 samples/tz-sample.lua diff --git a/README.md b/README.md index 5b86185..e36a3a5 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ The type of script is determined by the line (meta tag) at the beginning of the ### 5.7.1 * Added `tags` field to the app table +* Added `system:tz()` method ### 5.7.0 @@ -327,6 +328,7 @@ The function takes a command table of this format as a parameter: * `system:alarm_sound(seconds)` - make alarm sound; * `system:share_text(string)` - opens the "Share" system dialog; * `system:lang()` - returns the language selected in the system; +* `system:tz()` - returns TimeZone string (example: Africa/Cairo); * `system:tz_offset()` - returns TimeZone offset in seconds; * `system:currency()` - returns default currency code based on locale; * `system:format_date_localized(format, date)` - returns localized date string (using java formatting); diff --git a/samples/tz-sample.lua b/samples/tz-sample.lua new file mode 100644 index 0000000..52f39ef --- /dev/null +++ b/samples/tz-sample.lua @@ -0,0 +1,6 @@ +function on_load() + ui:show_lines{ + "Time zone: "..system:tz(), + "Offset in seconds: "..system:tz_offset() + } +end