After I shared my previous post regarding the revamped date picker control on Twitter, one of the comments from Carsten Groth was to further improve the component by providing the ability to control the first day of the week, as it is Sunday for the US and Monday for Europe.
I started off with some super complex changes to my simple component but as it turns out often, the change needed was a very simple one. The Weekday function assumes Sunday as the first day of the week, even if you don't specify it explicitly. So I had to explicitly define the first day of the week in all Weekday functions using StartOfWeek enumeration based on a toggle value. As with the v1 of the component, the changes will become clearer when you explore the component.
Here is how the control behaves now:
Here is a link to the component.
So keep your suggestions coming and I will try to incorporate them! Until then.
Have fun! Get addicted!
1 thought on “Revamping the Date Picker Control – v2”