Our blazing fast Grid component built with pure JavaScript


Post by syless »

Hi,

I made the column as date type like below.

{
    text: 'start date',
    field: 'StartDate'
    type: 'date',
    format: 'YYYY-MM-DD',
}

If I change the value to April 11, 2023, it looks normal on the screen, but the value with the locale specified in the form of '2023-04-10T15:00:00.000Z' is saved in the store and changes.

I want the saved value to be the actual selected date in the form of '2023-04-11' regardless of the locale. Is there a way?

Thank you.


Post by johan.isaksson »

Hi,

The format on the column is a "display format", it does not control the format in data. To control the format in data, you need to make sure you are using a date data field, and configure the format on it.

https://bryntum.com/products/scheduler/docs/api/Core/data/field/DateDataField

For example:

class MyModel extends Model {
  static fields = [
    { type : 'date', name : 'StartDate', format : 'YYYY-MM-DD' }
  ]
}

(And configure your store to use that model, or define the fields directly on the store)

Best regards,
Johan Isaksson

Post Reply