Open Evercosta opened 2 years ago
@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.
I have the same issue, want to translate month to en. Angular v17
I have the same issue, want to translate month to en. Angular v17
Have you found any solutions yet?
I have the same issue, want to translate month to en. Angular v17
Have you found any solutions yet?
only this
translateCalendarToEng(): void { let svgHTML = this.el.nativeElement.children[0].children[0].children[0].children[1].children[0].children[1].innerHTML;
for (const [chineseMonth, englishMonth] of Object.entries(CHINES_MONTH_MAP)) {
const regex = new RegExp(chineseMonth, 'g');
svgHTML = svgHTML.replace(regex, `${englishMonth}/`);
}
// Remove the "日" character
svgHTML = svgHTML.replace(/日/g, '');
// Replace "没有数据" with "No data"
svgHTML = svgHTML.replace(/没有数据/g, 'No data');
this.el.nativeElement.children[0].children[0].children[0].children[1].children[0].children[1].innerHTML = svgHTML;
// eslint-disable-next-line max-len
this.el.nativeElement.children[0].children[0].children[1].children[0].children[0].children[0].children[0].children[0].children[0].children[1].innerText =
'No Data';
}
You can configure
dateFormat
to implement language change// example :
Format rules: https://date-fns.org/v2.28.0/docs/format