DEV Community

Cover image for A Custom date-picker in Svelte
Rasmus Schultz
Rasmus Schultz

Posted on

A Custom date-picker in Svelte

I have this fairly small, but fully functional, custom date-picker UI control, which I've been porting between UI frameworks for quite a few years.

I ported this example to Svelte about 3 years ago, and today I decided to update it to Svelte 3.

Try it out 🚀


I always try this first with any new framework to see how they stack up. Perhaps the most important thing demonstrated by this use case, is the ability to validate and conditionally accept a value into the control's internal date state - and the ability to modify the control's view state by navigating through months without changing the value.

(it was quite a departure from the old version, in case you'd like to compare.)

There's not a lot more to say about this. Enjoy. 🙂

Top comments (3)

Collapse
 
renanfranca profile image
Renan Franca

Do you have this component in AngularJs?

Collapse
 
mindplay profile image
Rasmus Schultz

I did, many years ago - I'm afraid I haven't been very good at archiving these. I sort of want to go back and find or recreate them in different frameworks for comparison... That would be quite a lot of work though. I haven't always published these - a lot of times, it's just been something I do, as test for the framework, and as an exercise for myself. 🙂

Collapse
 
renanfranca profile image
Renan Franca

It's cool! Thanks ☺️