Skip to content

datetimeinsert

The community/plugin/datetimeinsert directory contains files for a Talon plugin that inserts the current date and time in various formats.

The core logic is in datetimeinsert.py. It defines two actions, time_format and time_format_utc, which return the current time and current UTC time respectively, formatted according to a provided format string. If no format string is provided, the time is returned in ISO format. These actions are made available to Talon scripts through the @mod.action_class decorator.

datetimeinsert.talon provides voice commands to insert the date and time using the actions defined in datetimeinsert.py. The commands call user.time_format and user.time_format_utc with specific format strings to produce the desired output. For example, "date insert" inserts the current date in the format "YYYY-MM-DD". There are commands for inserting date and timestamps, both in the local timezone and UTC, and with high-resolution timestamps including milliseconds.