Home forums Using CanvasJS Formating

This topic contains 1 reply, has 2 voices, and was last updated by  Sunil Urs 1 year, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #7487



    I’ve a function opening a window when clicking a datapoint on my line :

    function onClick(e)
    window.open(‘myfile.cfm?script=’ + e.dataPoint.x );

    (It display an sql result with the value of script parameter.)

    The problem is the format of the e.dataPoint.x value. It’s a date, and depending of the client browser, it gives :

    for IE : Thu May 22 00:00:00 UTC 0200 2014
    for chrome : Thu May 22 2014 00:00:00 GMT 0200 (Paris, Madrid (heure d’été))

    (note : i’m in Belgium/french)

    it perturbs the sql request because the condition is a date parameter .

    Any ideas ?




    Sunil Urs


    As you mentioned JavaScript Date Objects are formatted differently by different browsers. Only option here is to do custom format date value before displaying. You can use libraries like momentjs for the same.

    Sunil Urs

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.