Year get caclulated wrong when using Fiscal Year

when I use fiscal year which starts at Oct 1 , the first year is calculated wrong. For example, if I have tasks starts at Oct 1 2018 , the chart will show like this:
FY 2017 FY 2017 FY 2018 …
I’m attaching a sample project here.

Has anyone had the same issue? any solution would be appreciated (1.1 MB)

Hi @thao_trinh!

  1. Your “fiscalYearLabel()” function is unused.

  2. You need to use gantt.templates.date_scale to set custom date values in the scale instead gantt.config.date_scale. Here is a related article:

  3. Please remove gantt.config.date_scale and set your “fiscalYearLabel()” function to the gantt.templates.date_scale.

  4. Please pay attention you need to set templates.date_scale value in the “onTemplatesReady” event.
    So you need to add such code to your project:

gantt.attachEvent("onTemplatesReady", function(){
  gantt.templates.date_scale = fiscalYearLabel 

Here is a snippet with your full code modified:

You can use your “fiscalYearLabel()” function as a template for the subscale. Just add this object {unit:"fiscal_year", step:1, template:fiscalYearLabel} to gantt.config.subscales array. Here is a snippet you can see how it can be implemented:

1 Like

Hello Thao,
The dev team updated the scales API. Now you can specify the templates directly in the scale property and list all scales you need in one object:

Originally, you had this configuration:
Here is the updated configuration:


Do you mind taking a look at the linked snippet? Using your code I am trying to get FY2021 but the scale is backdating to FY2020. Thanks!

Hello Dakota,
The scale depends on the task dates unless you manually specify it with the gantt.config.start_date and gantt.config.end_date parameters:

So, you can update the milestone date or set the displayed date range:

If you need something different, please, send me a picture of how you imagine it should look like.

1 Like