material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Date format in column type date.

Open Androsv96 opened this issue 6 years ago • 3 comments

Is there anyway to set a specific date format for column type date? Current is: 04.02.2020 when editing. After editing is 4/2/2020 Wanted: 04-02-2020.

I have the following table

 <MyTable
    title={TABLE_TITLE}
    columns={TABLE_COLUMNS}
    data={data}
    editable={{
      onRowUpdate: (newData, oldData) =>
        new Promise((resolve, reject) => {
          setTimeout(() => {
            {
            }
          return resolve();
          }, 1000)
       }),
    onRowAdd: (newData) =>
       new Promise((resolve, reject) => {

            setTimeout(() => {
                {
                   let tempNewData = data.concat({
                     ...newData, bornDate: MOMENT(newData.bornDate).format("DD-MM-YYYY"),
                     otherDate: MOMENT(newData.otherDate).format("DD-MM-YYYY"),
                     action: "added"
                  });
                  setData(tempNewData):
              }
            return resolve();
             }, 1000)
   }),
}}

As you see rigth after the user adds a row and selects a date I formate it to DD-MM-YYYY. It shows correctly. But if the user tries to modify it, the following error appears in the field: Untitled

Or is there anyway to disable that error msg? Thanks.

Androsv96 avatar Apr 02 '20 15:04 Androsv96

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Jul 05 '20 18:07 stale[bot]

same issue

GusMartins499 avatar Mar 25 '21 12:03 GusMartins499

Same issue here too.

yfrfelipe avatar May 04 '21 06:05 yfrfelipe