Module ui.widget.datetimewidget

Widget for setting the date or time.

Example for input a time:

local DateTimeWidget = require("ui/widget/datetimewidget")
local _ = require("gettext")

local time_widget = DateTimeWidget:new{
    hour = 10,
    min = 30,
    ok_text = _("Set time"),
    title_text = _("Set time"),
    info_text = _("Some information"),
    callback = function(time)
        -- use time.hour and time.min here
    end
}
UIManager:show(time_widget)

Example for input a date:

local DateTimeWidget = require("ui/widget/datetimewidget")
local _ = require("gettext")

local date_widget = DateTimeWidget:new{
    year = 2021,
    month = 12,
    day = 31,
    ok_text = _("Set date"),
    title_text = _("Set date"),
    callback = function(time)
        -- use time.year, time.month, time.day here
    end
}
UIManager:show(date_widget)

Example to input a duration in days, hours and minutes:

local DateTimeWidget = require("ui/widget/datetimewidget")
local _ = require("gettext")

local date_widget = DateTimeWidget:new{
    day = 5,
    hour = 12,
    min = 0,
    ok_text = _("Set"),
    title_text = _("Set duration"),
    callback = function(time)
        -- use time.day, time.hour, time.min here
    end
}
UIManager:show(date_widget)



generated by LDoc 1.5.0 Last updated 2024-11-21 07:57:34