Moment.js recognize decimal number as date

Moment.js recognize decimal number as date

gt.guybrushgt.guybrush Posts: 6Questions: 2Answers: 0

Hi, in my table i see that many columns are interpreted as dateTime format by Moment plugins, and this is not a real problem, but same things occurs os some numeric columns, and only for some row.

this is the debug: http://debug.datatables.net/icabuw

real problem are columns GiorniFattiAnnoCorrente and GiorniFattiAnnoCorrente

where first row is render as date, so 244,5 becomes "01/05/0244" and 4,5 becomes "04/05/2017"
while second row is correct: 181,75 and 1 remain as number

datatable moment is set iin this way:

$.fn.dataTable.moment('DD/MM/YYYY');

Answers

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    244,5 becomes "01/05/0244"

    I don't really understand this part I'm afraid. The data in the table does have 01/05/0244 but I don't understand how the 244,5 fits in or where it comes from.

    Can you link to me to a test case showing the issue please?

    Thanks,
    Allan

  • gt.guybrushgt.guybrush Posts: 6Questions: 2Answers: 0

    html tag is created by aspx .net page that get data from sql server as List<Object> and send to page

    sql server have 244,5 as value for that column but in table this value is rendered as the date i wrote.

    my first thought was that dataTables change it, now i'am investigating also in how data from database is rendered in the page

  • gt.guybrushgt.guybrush Posts: 6Questions: 2Answers: 0

    find it: problem was data render from datasource to page.

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    Thanks for the extra information. I think I'd really need a link to a test case showing the issue to fully understand it and help debug it.

    Allan

This discussion has been closed.