0

My problem is that in my database all date column is stored in timestamp so during displaying data on the table we convert this into human-readable .So I want to do the same thing during export.

Below picture is my export data

the red colour portion is timestamp value which is stored in a database so during export I want this as human-readable date and time.

This is my code

      export const onExport = (exportParams) => {
      let endpoint = exportParams.endpoint;
      if(store.state.project && store.state.project.id){
      endpoint += "&projectId=" + store.state.project.id;
    }
    window.location =
        store.state.api.url.replace("/v2.1", "") +
        "/grid/data/export?endpoint=" +
        encodeURIComponent(endpoint) +
        "&columns=" +
        encodeURIComponent(JSON.stringify(exportParams.columns)) +
        "&export-format=" +
        exportParams["export-format"] +
        "&name=" +
        exportParams.name +
        "&token=" +
        store.state.api.token;
      store.state.project.id : '';
      }; 

I go through several questions on StackOverflow but I did not find any solution

I visited. Javascript to export html table to Excel but I did not get my answer

In the database this column is stored as timestamp

The above picture is of stored value in the database.

So my goal is to get this column as human-readable in the export results. Thanks!

  • I got the solution, handle from backend during export I send a key conversion-fn: 'longToDate with export column data, and according to this we change the date into human-readable and send back to the response. `{ path: "databases.lastTestedOn", alias: "Last Checked on", 'conversion-fn': "longToTime", },` – Nilesh Mishra Feb 21 '22 at 16:19

0 Answers0