Author Topic: type datetime render  (Read 590 times)

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
type datetime render
« on: July 21, 2023, 08:36:02 pm »
Hello,

Some data comes from sql, json, xml in "2023-05-22T00:00:00" format. I have set colmodel datatype=date. I am doing Format:dd/mm/yyyy.

(+) The format changes in the grid.
(+) The format changes in the Print.
(+) The format changes in the html.
(+) It changes in csv,  (-) but when exporting to excel, the data in the xlsx file is not the same. It comes as "2023-05-22T00:00:00".

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: type datetime render
« Reply #1 on: July 24, 2023, 09:46:59 pm »
Looking into it.

hirehop

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: type datetime render
« Reply #2 on: August 01, 2023, 08:11:48 pm »
i have did it some other way please check below
Code: [Select]
eachCell:function(cell, ci, ri, column, rowData){
// get the orininal cell value;
cell["value"] = rowData[ column["dataIndx"] ];

// set date format to  create date , out date, and return date
if([ "OUT_DATE", "RETURN_DATE"].includes(cell.dataIndx))
{
var date = empty(cell["value"]) ? false : moment(cell["value"]),
days = date ? date.diff("1900/01/01", "days")+2 : false,
converted = date ? days + ((date.second() + (date.minute()*60) + (date.hour()*60*60)) / 86400) : false;
cell["format"] = "dd/mm/yyy";
if(converted)
cell.value = converted;
}
}

Initially we can set all kind of formats through this
please if we can get better way to render dates and other formats, it will be very fine.....
« Last Edit: August 01, 2023, 08:13:58 pm by hirehop »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: type datetime render
« Reply #3 on: August 20, 2024, 07:30:53 pm »
This issue was fixed in v9.0.2