date field issue for nightly builds searchBuilder version

date field issue for nightly builds searchBuilder version

udaymagdumudaymagdum Posts: 23Questions: 16Answers: 0
edited January 2022 in SearchBuilder

Recently i have updated searchBuilder to nightly builds.
previously(for version 1.1) For date fields when i select value it shows in text field(datepicker field) MM/DD/YYYY format
e.g "06/01/2021"

when i update to nightly searchBuilder version on backend value pass as ["2021-05-31T18:30:00.000Z"]
and also one day previous than selected.

Any change require for format date ?
for previous version set as

$.fn.dataTable.moment('MM/DD/YYYY');

But it not works nightlysearchBuilder version

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    It seems to be behaving here as expected. Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.

    Cheers,

    Colin

  • jjacobsonjjacobson Posts: 2Questions: 0Answers: 0

    It is because of this issue: https://github.com/DataTables/SearchBuilder/issues/6

    This breaks date formats when using server side processing.

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @jjacobson ,

    In that issue it sounds as though the issue is occurring on the serverside? Is that correct?

    Are you able to change colins test case or please link to your page as he asked? We are probably going to need to see the actual error to fix it properly.

    Thanks,
    Sandy

  • jjacobsonjjacobson Posts: 2Questions: 0Answers: 0
    edited February 2022

    No, this is client side. Take a look at the requests made to the server in this example.
    http://live.datatables.net/macizuwa/19/edit
    Specifically once you set a date and then try to page through the table. Note the format that I've set:

    "$.fn.dataTable.moment('MM/DD/YYYY');"

    Request #1 to the server when selecting a date:

    After selecting the next page:

    If you are going to call toISOString (which makes sense for sorting the two values prior to the request) you can't call it again using the custom format during later requests because moment then tries to parse the ISO date using my format, which is not in ISO.

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Thanks for the test. We'll take a look, probably towards the middle of next week, and report back then,

    Colin

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @jjacobson ,

    Thanks for pointing that out, I can see the dates changing which shouldn't be happening. I've raised an issue internally (DD-2475 for my reference) and will report back here when there is an update.

    Thanks,
    Sandy

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @jjacobson ,

    I was unable to replicate this locally, but have made a fix and tested using the nightly build that appears to be working. See this example. This will be available in the next SearchBuilder release which we hope will be in the next few weeks. Until then you can access the fix from the nightly builds.

    Thanks,
    Sandy

Sign In or Register to comment.