amcharts / amcharts4

The most advanced amCharts charting library for JavaScript and TypeScript apps.
https://www.amcharts.com/
1.16k stars 322 forks source link

Wrong year for first day of year #4420

Closed bmampaey closed 2 months ago

bmampaey commented 2 months ago

Bug description

When making a chart with dates on the X axis, the first day of the year appears with the previous year. For example the dates will be 31 Dec 2011 | 1 Jan 2011 | 2 Jan 2012 and I expect them to be 31 Dec 2011 | 1 Jan 2012 | 2 Jan 2012

The bug was not there before version 4.10.39

In the fiddle below, you can see that the error for the first day of year 2012 is on the X axis label (zoom in eventually), but also on the X axis tooltip

https://jsfiddle.net/nrsy942e/

Environment (if applicable)

Amchart version 4.10.39 , firefox 128.0 on Ubuntu

zeroin commented 2 months ago

Try to replace YYYY with yyyy. YYYY is Year (of "Week of Year"), used in ISO year-week calendar. May differ from calendar year.

https://www.amcharts.com/docs/v4/concepts/formatters/formatting-date-time/

bmampaey commented 2 months ago

Indeed, that was the problem. I see that there is even a "note" about it. Sorry for the false alert.