ToISOString breaking dates
Closed this issue · 2 comments
Line 2044 in 2a3ceb3
This line is causing me a headache. This converts the date to an ISO string ex. "2022-01-16T09:00:00.000Z"
The next time you make a request to the server it tries to create a moment date using that ISO string along with your custom formatter. This results in an invalid date because the custom format doesn't line up with that date.
Hi @jjacobson ,
This sounds to me like an issue with the server side implementation? Is that where the error is occurring?
Either way, as mentioned in your forum post, please can you link to a test case so that we can actually see the issue occurring. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Thanks,
Sandy
PS. We prefer please if you find an issue to raise it in the forum. That is our preferred way of tracking them and keeps everything in one place for us :)
Copying my response here for history:
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.