1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-06 23:56:13 +02:00
Files

21 lines
620 B
TypeScript

import { CommandRuntime, CommandDeclaration, CommandContext } from '@joplin/lib/services/CommandService';
import { _ } from '@joplin/lib/locale';
import { CommandRuntimeProps } from '../types';
import time from '@joplin/lib/time';
export const declaration: CommandDeclaration = {
name: 'insertDateTime',
label: () => _('Insert time'),
iconName: 'material calendar-plus',
};
export const runtime = (props: CommandRuntimeProps): CommandRuntime => {
return {
execute: async (_context: CommandContext) => {
props.insertText(time.formatDateToLocal(new Date()));
},
enabledCondition: '!noteIsReadOnly',
};
};