Insert Date/Time
Plugin alias: insertdatetime
editor42.init({
plugins: 'insertdatetime'
});
Inserts the current date and/or time into the editor content using configurable strftime-style format patterns (%Y, %m, %d, %H, %M, %S, etc.). Can optionally wrap the value in an HTML <time> element with a machine-readable datetime attribute.
Options
| Option | Type | Default | Description |
|---|---|---|---|
insertdatetime_dateformat | string | '%Y-%m-%d' | Default date format. |
insertdatetime_timeformat | string | '%H:%M:%S' | Default time format. |
insertdatetime_formats | string[] | ['%H:%M:%S', '%Y-%m-%d', '%I:%M:%S %p', '%D'] | Formats shown in the dropdown. |
insertdatetime_element | boolean | false | Wrap inserted value in a <time> element. |
Commands
| Command | Description |
|---|---|
editor42InsertDate | Inserts the current date. |
editor42InsertTime | Inserts the current time. |
Toolbar buttons
| Name | Type | Description |
|---|---|---|
insertdatetime | Split button | Main action uses last-selected format; dropdown shows all formats. |
Menu items
| Name | Type | Description |
|---|---|---|
insertdatetime | Nested menu item | Submenu of all formats. |