ngx-gantt
ngx-gantt copied to clipboard
How to change language
You can configure dateFormat
to implement language change
// example :
import { GANTT_GLOBAL_CONFIG } from 'ngx-gantt';
@NgModule({
providers: [
{
provide: GANTT_GLOBAL_CONFIG,
useValue: {
dateFormat: {
yearQuarter: `QQQ 'of' yyyy`,
month: 'LLLL',
yearMonth: `LLLL yyyy'(week' w ')'`
}
}
}
]
})
export class AppModule {
}
Format rules: https://date-fns.org/v2.28.0/docs/format
@walkerkay Tank you, last question: How changing locale globally?
@walkerkay Tank you, last question: How changing locale globally?
Time zone ? ngx-gantt data uses timestamp. If you need to show the time, you need to use some pipes to achieve it after obtaining the time in the data.
Hello @walkerkay.
Congrats for this project, I liked so much. Could you tell me, how can I set the locale to ptBR in date-fns, to project-wide.
I'm already used GanttViewOptions, dateFormat, but I need put my project as portuguese.
Is this possible?
I also can not find anywhere to configure the locale of displayed time and the properties of GanttViewOptions do not have the one named dateformat either.
How can I translate this:
I have the same issue. It seems the GanttDate class doesn't provide any entry points to set date-fns locale option (https://date-fns.org/v2.0.0-alpha.26/docs/Locale). So my week numbering is not ISO, some year have not the right number of weeks. It is possible now to set default Locale in date-fns (https://date-fns.org/v2.29.0/docs/setDefaultOptions) but only since the version 2.29:
// Set global locale: import { setDefaultOptions } from 'date-fns'; import { fr } from 'date-fns/locale'; setDefaultOptions({ locale: fr });
Update date-fns to 2.29 is probably the esiest way to solve this issue without touching anything.
I have the same issue. It seems the GanttDate class doesn't provide any entry points to set date-fns locale option (https://date-fns.org/v2.0.0-alpha.26/docs/Locale). So my week numbering is not ISO, some year have not the right number of weeks. It is possible now to set default Locale in date-fns (https://date-fns.org/v2.29.0/docs/setDefaultOptions) but only since the version 2.29:
// Set global locale: import { setDefaultOptions } from 'date-fns'; import { fr } from 'date-fns/locale'; setDefaultOptions({ locale: fr });
Update date-fns to 2.29 is probably the esiest way to solve this issue without touching anything.
Yes, the date format uses date-fns, so you need to import date-fns to set the time zone.