StateSave with serverside restores wrong date value SearchBuilder and ColumnControl

StateSave with serverside restores wrong date value SearchBuilder and ColumnControl

lbermudezlbermudez Posts: 7Questions: 0Answers: 0

Link to test case: https://intranet2.cimne.com/ws/demo_datatables

With ColumnControl and stateSave: true, a date entered as 06/10/1984 filters correctly. However, after reloading the page, the saved state restores it as 06-10-1984, and Editor PHP sends that value to MySQL, causing an Incorrect DATETIME value error.

SearchBuilder, when input 06/10/1984 doesnt work serverside.
SearchBuilder will also restore the state as 1984-10-06 00:00:00 and the search doesnt work.

I'm using the nigtly build as discussed here:
https://datatables.net/forums/discussion/81852/problem-with-date-type-on-3-0-update#latest

Replies

  • lbermudezlbermudez Posts: 7Questions: 0Answers: 0

    did a couple tests:

    the working value sent when searching for 06/10/1984 is:
    columns[2][columnControl][search][value] 1984-10-06T00:00:00.000Z

    but after refreshing, state save reloads the value as:
    columns[2][columnControl][search][value] 06-10-1984

    the column is declared simply as:

     {
                data: 'fecha',
                title: 'Date',
                columnControl: ['order', 'searchDropdown'],
            },
    

    and on the server side:

    Field::inst('demo.fecha_hora', 'fecha')
        ->getFormatter(Format::dateSqlToFormat('d/m/Y' ))
        ->setFormatter(Format::dateFormatToSql('d/m/Y')),
    
  • allanallan Posts: 65,871Questions: 1Answers: 10,959 Site admin

    Many thanks for the test case. I'll take a look next week and get back to you.

    Allan

Sign In or Register to comment.