correctFormat for date is not working

Tags: #<Tag:0x00007efc6d2e4b70>

hi I am registering my custom type as below

Handsontable.cellTypes.registerCellType('rawdate', {
editor: Handsontable.editors.DateEditor,
renderer: Handsontable.renderers.DateRenderer,
className: 'htCenter',
dateFormat: 'MM/DD/YYYY',
correctFormat: true,
defaultDate: '01/01/2018',

})

Everything works fine except correctFormat. If I select from calendar the format woks fine. but when I load date or type date manually in any other format it does not change to format specified. I have followed other articles too and tried rendering and using validateCells() after data load through hooks. But noting worked for me. All other formats are just working fine.
code sample (not executable) https://jsfiddle.net/ArslanAsif/w56j2umy/2

Hi @chunnumunnu99

does it work when you call instance.validateCells() after loading the data?
The format does not apply automatically. It needs to be validated.

@aleksandra_budnik thanks for quick response. I followed through these articles


I have tried
var hot = new Handsontable(container, hotSettings);
Handsontable.hooks.add(‘afterLoadData’, hot.validateCells);

but noting worked in my case

I’ve filled the missing HTML but still it would be better to analyze if we could fake some data https://jsfiddle.net/AMBudnik/y1rpmj23/
Can you please fill the data with something that has the same format as your real data (array of arrays, array of objects).

ps. I can see that none of those cell types use validator. You may consider adding it as the format won’t work without a validator.

Sorry my mistake. you were right. there was issue with my validator in column definitions Its working fine now thanks

you’re welcome :slight_smile: