Angular-calendar: Change format date to dd/mm/YYYY and locale in italian

Created on 7 Jun 2018  路  2Comments  路  Source: mattlewis92/angular-calendar

Describe the bug
Hi,
I am trying to change the calendar language to italian and change format date in dd-mm-yyyy.
I tried changing the local string from eng to it in the calendar-header-component

export class CalendarHeaderComponent {
@Input() view: string;

@Input() viewDate: Date;

@Input() locale: string = 'it';

@Output() viewChange: EventEmitter = new EventEmitter();

@Output() viewDateChange: EventEmitter = new EventEmitter();
}
but still nothing is changing, am I missing something?

On the format date, I am not understanding how to use the CalendarDateFormatter class properly

Minimal reproduction of the problem with instructions

Screenshots

Versions:

  • @angular/core: Angular: 5.2.11
  • angular-calendar : angular 5.0+ calendar
  • Chrome 66.0.3359.181

Most helpful comment

@RignonNoel is on the right track with this, these 2 demos should give you what you need:
https://mattlewis92.github.io/angular-calendar/#/i18n
https://mattlewis92.github.io/angular-calendar/#/customise-date-formats

All 2 comments

You have a section of the demo about the I18N : https://mattlewis92.github.io/angular-calendar/#/i18n

You will need to add some code in your module.ts

import { registerLocaleData } from '@angular/common';
import localeFr from '@angular/common/locales/fr';
[...]

registerLocaleData(localeFr);

[...]

About the formater, i don't really know how to use it but here is my working solution for the moment :laughing:

import { CalendarDateFormatter, CalendarEvent, CalendarEventAction, DAYS_OF_WEEK } from 'angular-calendar';

[...]

@Component({
  templateUrl: 'test.component.html',
  selector: 'app-test',
  styleUrls: ['test.component.scss'],
  providers: [
    {
      provide: CalendarDateFormatter,
      useClass: CalendarDateFormatter
    }
  ]
})

[...]

@RignonNoel is on the right track with this, these 2 demos should give you what you need:
https://mattlewis92.github.io/angular-calendar/#/i18n
https://mattlewis92.github.io/angular-calendar/#/customise-date-formats

Was this page helpful?
0 / 5 - 0 ratings

Related issues

teodoramalec picture teodoramalec  路  4Comments

daneshmandi picture daneshmandi  路  4Comments

Herb-sh picture Herb-sh  路  4Comments

PrasannaKolla picture PrasannaKolla  路  4Comments

sylvain-fr picture sylvain-fr  路  3Comments