qodesmith / datepicker

Get a date with JavaScript! A datepicker with no dependencies.
344 stars 101 forks source link

Can I customize year number on calendar picker? #137

Closed Chaiyaboon-Sruayiam closed 1 year ago

Chaiyaboon-Sruayiam commented 1 year ago

image

Can I customize year number that is on calendar picker? Or can you add more customizable config such as "yearDisplayOffset" and default value of "yearDisplayOffset" is 0 or function to manipulate year number before display or somethings like that.

Thank you.

qodesmith commented 1 year ago

@Chaiyaboon-Sruayiam I am currently working on a rewrite of the entire library (most options will stay the same) and I think this is a good idea - the ability to customize the year number. I forget what thread I saw it in, but I think the ability to also customize the day numbers should be available as well. I will add these.

qodesmith commented 1 year ago

@Chaiyaboon-Sruayiam What would you expect to happen on the overlay view where you can type in a year? Would you expect to type in 2562 and under the hood datepicker knows it is 2019? (I'm using your initial example)

qodesmith commented 1 year ago

I'm going to provide an unformatYear option that the user can provide to convert the user's year input on the overlay screen (i.e. 2562) to a number that JavaScript dates can consume (i.e. 2019).

For reference, here's the options you'll want to use that will be available in the upcoming rewrite of datepicker: