Home › forums › Using CanvasJS › canvasJS.formatDate() and IE 11 specific error
This topic contains 8 replies, has 3 voices, and was last updated by Sanjoy 1 year, 11 months ago.
Our date data comes to us as YYYY=MM-DD.
We discovered by accident that CanvasJS.formatDate('2017-08-30','MMM D, YYYY') will output Aug 29, 2017, not Aug 30…
CanvasJS.formatDate('2017-08-30','MMM D, YYYY')
However CanvasJS.formatDate('2017-08-30 00:00:01','MMM D, YYYY') will output Aug 30, 2017.
CanvasJS.formatDate('2017-08-30 00:00:01','MMM D, YYYY')
In setting our title we began using
axisXOption.title = CanvasJS.formatDate(json.dataset.start_date + ' 00:00:01','MMM D, YYYY') + ' to ' + CanvasJS.formatDate(json.dataset.end_date + ' 00:00:01','MMM D, YYYY');
Works in MS Edge, Chrome, FF etc. However we find that in IE 11 and previous we see
SCRIPT5022: Exception thrown and not caught canvasjs.min.js (67,13)
We will add some error handling on our end but can you advise as to how we get correct, formatted dates without this invalid date issue in IE 11?
http://jsfiddle.net/9vkjpegs/1/ will show xAxis title on Chrome/FF/MS Edge. On IE 11 (line 154 of fiddle)
http://jsfiddle.net/9vkjpegs/ will work in IE 11 due to commented out line 154
Thanks for reporting. We are looking into the issue. We will get back to you at the earliest.
We looked into your issue and observed that the ISO-format for date-time is (YYYY-MM-DDTHH:MM:SSZ), which is different from what you are using.
I have updated the fiddle please take a look.
Thank you very much. Is it expected behavior that CanvasJS.formatDate('2017-08-30','MMM D, YYYY') will output Aug 29, 2017, not Aug 30?
The formatDate() is working fine on our side. Please create a jsfiddle reproducing the issue so that we can look into it and help you better.
Thank you for the reply. This fiddle demonstrates the issue I see. http://jsfiddle.net/qzgtf8bt/
CanvasJS.formatDate(‘2017-08-30′,’MMM D, YYYY’) outputs Aug 29, 2017, not Aug 30.
We tried reproducing the issue with your jsfiddle, but it seems to be working fine. Here is the screenshot. Can you please provide complete browser and OS details, so that we can look into it and help you out.
Thank you for the reply. OS is Windows 10 Home. This set of screenshots shows OS and 4 up-to-date browsers with same results: Chrome, IE 11, MS Edge, and FireFox. Version information for all is in screenshot.
You can take a look at this work-around to overcome this issue. You can also take a look at this page for further clarification.
You must be logged in to reply to this topic.