How to validate multiple format for date

1 Answer 147 Views
Spreadsheet
GAURAV
Top achievements
Rank 1
GAURAV asked on 22 Sep 2022, 12:27 PM

Hello ,

I'm using below code for date validation

 sheetForNPD.range("O2:O100").validation({
        dataType: "date",
        showButton: true,
        comparerType: "between",
        from: "DATEVALUE(\"1/1/1900\")",
        to: "DATEVALUE(\"1/1/2050\")",
        allowNulls: true,
        type: "reject",
        titleTemplate: "Start Date validation error",
        messageTemplate: "Start Date should be between 1899 and 2050 year."
    }).format('MM-dd-yy');

 

But i need if user enter in these format then also acceptable 

    • Slashes

      • M/D/YY

      • M/D/YYYY

      • MM/DD/YY

      • MM/DD/YYYY

    • Dashes

      • M-D-YY

      • M-D-YYYY

      • MM-DD-YY

      • MM-DD-YYYY

    • Dots

      • M.D.YY

      • M.D.YYYY

      • MM.DD.YY

      • MM.DD.YYYY

    Is it possible in kendo spreadsheet can i validate these format for single column ?

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 27 Sep 2022, 08:23 AM

Hi Gaurav,

I am afraid that currently a single format can be set to the Spreadsheet cells as the cells.format option accepts only a single string. Thus, the validation will not allow multiple formats. If you think that such an enhancement would be a valuable addition to the suite, I would suggest you log the idea in our official Feedback Portal:

- https://feedback.telerik.com/kendo-jquery-ui

If it is suitable for your scenario, you could try to implement Regex-based validation:

- https://docs.telerik.com/kendo-ui/knowledge-base/regexp-validation

I hope this helps. 

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Spreadsheet
Asked by
GAURAV
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or