1234567891011121314151617181920212223242526 |
- export function generateNewTaskId(): string {
- /**
- * Generate a new task id based on the current timestamp and a random number.
- */
- return `${Date.now()}-${Math.floor(Math.random() * (999999 - 100000 + 1) + 100000)}`;
- }
- export function getCurrentTimestampStr(): string {
- /**
- * Get the current timestamp as a string in the format yyyy-MM-dd HH:mm:ss
- * using local timezone.
- *
- * @returns Formatted datetime string in local time
- */
- return new Date()
- .toLocaleString('en-US', {
- year: 'numeric',
- month: '2-digit',
- day: '2-digit',
- hour: '2-digit',
- minute: '2-digit',
- second: '2-digit',
- hour12: false,
- })
- .replace(',', '');
- }
|