()
| 2 | import color from 'picocolors'; |
| 3 | |
| 4 | async function main() { |
| 5 | const result = (await p.date({ |
| 6 | message: color.magenta('Pick a date'), |
| 7 | format: 'YMD', |
| 8 | minDate: new Date('2026-01-01'), |
| 9 | maxDate: new Date('2026-12-31'), |
| 10 | })) as Date; |
| 11 | |
| 12 | if (p.isCancel(result)) { |
| 13 | p.cancel('Operation cancelled.'); |
| 14 | process.exit(0); |
| 15 | } |
| 16 | |
| 17 | const fmt = (d: Date) => d.toISOString().slice(0, 10); |
| 18 | p.outro(`Selected date: ${color.cyan(fmt(result))}`); |
| 19 | } |
| 20 | |
| 21 | main().catch(console.error); |