Our state of the art Gantt chart


Post by jhughesoneplan »

I have date fields start and end specified with a format of YYYY-MM-DD HH:mm:ss. When adding a new task, the start/end of the task are sent in as a date field and not following that format:

added task: EndDate: Tue Jul 19 2022 17:00:00 GMT-0700 (Pacific Daylight Time) {}
added task sent to server: EndDate: "2022-07-20T00:00:00.000Z"
updated task: EndDate: "2022-07-21 17:00:00"
updated task sent to server: EndDate: "2022-07-21 17:00:00"

How can I resolve?


Post by tasnim »

Could you please provide the steps to reproduce it? It would be better to assist you if you could provide a runnable test case.

Good Luck :),
Tasnim


Post by jhughesoneplan »

Set your format in your model for start and end to "YYYY-MM-DD HH:mm:ss" then add a task. Sync to server and see what it sends. then edit a task and see what it sends.


Post by tasnim »

Hi,
I'm not able to reproduce it. Could you please provide a runnable test case so we can debug it?

Good Luck :),
Tasnim


Post by alex.l »

Set your format in your model for start and end to "YYYY-MM-DD HH:mm:ss" then add a task. Sync to server and see what it sends. then edit a task and see what it sends.

I just changed in our advanced example, only for test purposes

export default class Task extends TaskModel {

static $name = 'Task';

static get fields() {
    return [
        // added this line
        {name : 'startDate', format: 'MM-DD-YYYY'},
        
        'status' // For status column
    ];
}

And tried to change dates. In tasks.updated[] array that send on server I see

duration: 7
endDate: "2082-03-11T00:00:00+03:00"
id: 1
startDate: "03-02-2082"

So format has been applied.

Please, make sure you are noticed that all Date type fields send on server using ISO 8601 specified standards https://www.iso.org/iso-8601-date-and-time-format.html . This format is easy to parse afterwards. In case you need to store in database some specific formatting, you'll need to take care about parsing these dates in all places.
https://bryntum.com/docs/gantt/api/Core/helper/DateHelper#property-defaultFormat-static
https://bryntum.com/docs/gantt/api/Core/data/field/DateDataField#config-format
https://bryntum.com/docs/gantt/api/Core/helper/DateHelper

All the best,
Alex


Post by jhughesoneplan »

I am using 5.1.1 not 5.1.2. The date in the changes isn't even showing in the format you show, its actually a date object not even a string. again this happens only on add. Doing changes to tasks the dates show correctly in changes array. I upgraded from the latest 5.0.x and it seems to have broke then. I am 2 weeks from release cant update to 5.1.2 yet.


Post by tasnim »

Could you please provide us with a runnable test case so that we can reproduce and debug it?


Post by alex.l »

its actually a date object not even a string

I think we checked different places. Do you see Date object in JSON? Check Network>Payloads in DevTools. What format do you see?
And yes, would be nice to see the code you used. It will help to go forward here.

All the best,
Alex


Post by jhughesoneplan »

I am having a hard time reproducing this issue without being fully embedded in our code. However I did find that it changed between 5.0.4 and 5.0.5. Do you have a full change log for that? I am also using umd version, not sure if that differs.


Post by marcio »

Hey jhughesoneplan,

You can check the changes between versions using our API diff tool here https://www.bryntum.com/docs/gantt/#apidiff

UMD version should be just like other versions, with no behavior difference.

Best regards,
Márcio


Post Reply