mirror of
https://github.com/iDvel/rime-ice.git
synced 2026-05-14 00:30:37 +08:00
Compare commits
2 Commits
85c0b0f6c2
...
4e54d7edb1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e54d7edb1 | ||
|
|
20b21a0ebe |
@@ -61,11 +61,11 @@ function M.func(input, seg, env)
|
||||
|
||||
yield_cand(seg, os.date('%H:%M', current_time))
|
||||
yield_cand(seg, os.date('%H:%M:%S', current_time))
|
||||
yield_cand(seg, period_name .. " " .. os.date("%H:%M", current_time))
|
||||
yield_cand(seg, os.date("%H:%M %p", current_time))
|
||||
yield_cand(seg, period_name .. " " .. os.date("%I:%M", current_time))
|
||||
yield_cand(seg, os.date("%I:%M %p", current_time))
|
||||
-- 带上时间划分时,很少有带秒数的,暂时注释掉
|
||||
-- yield_cand(seg, period_name .. " " .. os.date("%H:%M:%S", current_time))
|
||||
-- yield_cand(seg, os.date("%H:%M:%S %p", current_time))
|
||||
-- yield_cand(seg, period_name .. " " .. os.date("%I:%M:%S", current_time))
|
||||
-- yield_cand(seg, os.date("%I:%M:%S %p", current_time))
|
||||
|
||||
-- 星期
|
||||
elseif (input == M.week) then
|
||||
@@ -76,10 +76,21 @@ function M.func(input, seg, env)
|
||||
yield_cand(seg, '礼拜' .. text)
|
||||
yield_cand(seg, '周' .. text)
|
||||
|
||||
-- ISO 8601/RFC 3339 的时间格式 (固定东八区)(示例 2022-01-07T20:42:51+08:00)
|
||||
-- ISO 8601/RFC 3339 的时间格式
|
||||
elseif (input == M.datetime) then
|
||||
local current_time = os.time()
|
||||
yield_cand(seg, os.date('%Y-%m-%dT%H:%M:%S+08:00', current_time))
|
||||
|
||||
-- 获取偏移量,例如 "+0800" 或 "+0000"
|
||||
local tz = os.date("%z", current_time)
|
||||
|
||||
-- 格式化时区
|
||||
-- 如果是零时区 (+0000/-0000),根据规范输出 "Z"
|
||||
-- 否则将 "+0800" 转换为 "+08:00"
|
||||
local iso_tz = (tz == "+0000" or tz == "-0000")
|
||||
and "Z"
|
||||
or tz:gsub("(%d%d)$", ":%1")
|
||||
|
||||
yield_cand(seg, os.date('%Y-%m-%dT%H:%M:%S', current_time) .. iso_tz)
|
||||
yield_cand(seg, os.date('%Y-%m-%d %H:%M:%S', current_time))
|
||||
yield_cand(seg, os.date('%Y%m%d%H%M%S', current_time))
|
||||
|
||||
@@ -116,7 +127,7 @@ function M.func(input, seg, env)
|
||||
-- suffix = "rd"
|
||||
-- end
|
||||
|
||||
yield_cand(seg, string.format("%d %s %s", day, month_names_long[month], year)) -- en_UK
|
||||
yield_cand(seg, string.format("%d %s %s", day, month_names_long[month], year)) -- en_UK
|
||||
yield_cand(seg, string.format("%s %d, %s", month_names_long[month], day, year)) -- en_US
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user