Grid datepicker format problem when editing and updating date

Hello. I have a problem when I manually edit my Grid and select a new date. When I press update, the new date is not formatted in the way I'd like it to be.


How can I get this date formatted in the "dd/MM/yyyy" format?

Date before updating:


Date after updating:



Full code:

const myEditSettings = {
allowEditing: true, allowAdding: true, allowDeleting: true
  };

  const mytoolbarOptions = ['Edit', 'Delete', 'Update', 'Cancel'];

  const turnOptions = [
    { turnName: "Mañana",turnId: "1"},
    { turnName: "Noche",turnId: "2"},
    { turnName: "Tarde",turnId: "3"}
  ];

  const turnParams = { params: {
    allowFiltering: true,
    dataSource: new DataManager(turnOptions),
    fields: { text: "turnName", value: "turnName" },
    query: new Query()
}};

  return (
    <div>
      <JktHeader></JktHeader>
      <GenerateUser addUser={userListHandler} addSubject={subjectHandler}></GenerateUser>
      {subjectList.length === 0 && subjectList ? null : (<GridComponent toolbar={mytoolbarOptions} editSettings={myEditSettings} allowFiltering="true" filterSettings={myFilter} dataSource={subjectList} Inject={Filter}>
        <ColumnsDirective>
        <ColumnDirective isPrimaryKey={true} field="subjName" headerText="Materia" headerTextAlign="center" textAlign="center" width={300}></ColumnDirective>
        <ColumnDirective field="subjTeacher" headerText="Profesor" width={300} headerTextAlign="center" textAlign="center" allowEditing={false}></ColumnDirective>
        <ColumnDirective field="subjectTurn" headerText="Turno" width={250} textAlign="left" editType="dropdownedit"edit={turnParams}></ColumnDirective>
        <ColumnDirective field="subjectDate" headerText="Fecha inicio" textAlign="left" width={300} editType="datepickeredit"></ColumnDirective>
        </ColumnsDirective>
        <Inject services={[Filter,Edit,Toolbar]}/>
      </GridComponent>)}
    </div>
  );
}

Thanks in advance



1 Reply

RR Rajapandi Ravi Syncfusion Team August 1, 2022 12:52 PM UTC

Hi Hector,


Greetings from Syncfusion support


You can format date values either using built-in date format string or custom format string. You can also use custom format string to format the date values. Some of the custom formats and the formatted date values are given in the below documentation. Please refer the Documentation link for more information.


Documentation: https://ej2.syncfusion.com/react/documentation/grid/columns/columns/#date-formatting


Regards,

Rajapandi R


Loader.
Up arrow icon