Here's a simple date & time picker in svelte using tailwind and typescript, I made it to schedule reminders in my app. It uses the 12-hour AM/PM clock. You'll need to change the tailwind bg- and color- classes to match with your app.
Check the source code, it emits the 'set' event when a time is set. It accepts optional property "time," which is mmilliseconds since the epoch or any other value that can be used to make a Date
.
Features:
🎨 Styled in tailwind
⌨️ Typed in typescript - no any
!
⏰ Uses the current time as the default, or accepts a custom time
⏰ User-friendly and obvious AM/PM switch
🔧 Forces correct formatting, with single-digit minutes starting with 0
🔧 Forces valid times
🚀 ~100 lines of code