Date type is not showing correct date when edited
Date type is not showing correct date when edited
Hello - I just purchased your editor product.
I'm populating a datatables.net table from a JSON object which is pulled from a Sharepoint site via a REST request.
I am attempting to use the inline editor to edit my date field. The date value is 06/01/2015 (june 1, 2015).
In the editor declaration, when I set the type to "text", the textbox shows the correct date as shown in the table for editing.
However, when I set the type to "date", the calendar widget pops up, but shows Monday, Dec 7, 2020.
I do have my name and data columns set to the correct field name. Is there something I'm missing?
Answers
After some more research, I see that neither the JQuery UI datepicker NOR the HTML5 date picker are seemingly able to pick up the date from my date column.
In the date column, I'm formatting the date as "MM/DD/YYYY" from the "moment.js" library, HOWEVER, I believe the actual data that's being picked up from the table is different.
When I attempt to set the editor type of the date field to "text", then edit the field this is what I get:
Shown on table: 06/10/2015
Text Box when Edited: 2015-06-10T05:00:00Z
I believe the problem is somehow related to the way the editor is parsing the date that I have and can't figure it out, so the JQueryUI version, it's just giving me a date way out in the future...on the HTML5 version, it's not giving me anything at all ("mm/dd/yy").
Is there a way for me to "help" the editor get a better date - one that it can understand?
My code is shown below. I haven't yet hooked up the CRUD methods...just trying to get the form to work first.
Hi i noticed that the editor date format differs from the moment date format - is this by design?
So what appears to be happening here is that the actual data in the JSON data feed is in IS8601 format (e.g. 2015-06-10T05:00:00Z).
When you use the
columns.render
option with Moment to transform the data for the column display, it effects only the data that DataTables displayed - not the underlying data.Frustratingly it appears that jQuery UI doesn't accept much other than the format specified or a Javascript
Date
object (I can't understand why they wouldn't also accept IS8601 as a "wire format").To help address this, the Editor libraries provide get and set formatters so that the client-side will only need to handle one date format.
Are you using the Editor libraries, or do you have the ability to change the date format in the JSON data in some other fashion?
Thanks,
Allan