mymth / vanillajs-datepicker

A vanilla JavaScript remake of bootstrap-datepicker for Bulma and other CSS frameworks
MIT License
743 stars 154 forks source link

Datapicker is adding '01' after date, when view is setup as months. #175

Open dobrzyc opened 9 months ago

dobrzyc commented 9 months ago

My setup is: datepicker = new Datepicker(elem, { buttonClass: 'btn', format: 'yyyymm',
todayButton: true, todayHighlight: true, startView: 1, pickLevel: 1, clearButton: true, autohide: true, datesDisabled: true, });

When I chose date, date picker is adding '01' to choose value. For example: I've chose 202205, and input box i showing 20220501.

The same behaviour is on the live demo.

mymth commented 9 months ago

Please read the first one in the notes in here: https://mymth.github.io/vanillajs-datepicker/#/date-string+format?id=date-format

You need to create a custom parser/formatter to handle separator-less date string.