Angular-calendar: locale.toLowerCase is not a function

Created on 22 Mar 2018  路  1Comment  路  Source: mattlewis92/angular-calendar

Versions:

Angular: 5.2.8
angular-calendar: ^0.23.7

Error:

CalendarMonthCellComponent.html:15 ERROR TypeError: locale.toLowerCase is not a function
    at findLocaleData (common.js:1486)
    at getLocaleId (common.js:1109)
    at getNamedFormat (common.js:3704)
    at formatDate (common.js:3665)
    at DatePipe.transform (common.js:4455)
    at CalendarDateFormatter.CalendarAngularDateFormatter.monthViewDayNumber (angular-calendar.js:400)
    at CalendarDatePipe.transform (angular-calendar.js:523)
    at checkAndUpdatePureExpressionInline (core.js:13187)
    at checkAndUpdateNodeInline (core.js:13897)
    at checkAndUpdateNode (core.js:13836)

In my html

<div [ngSwitch]="view">
        <mwl-calendar-month-view [locale]="pt-BR" *ngSwitchCase="'month'" [viewDate]="viewDate" [events]="events" [activeDayIsOpen]="activeDayIsOpen"
          (dayClicked)="dayClicked($event.day)" (eventClicked)="editSchedule($event.event, true)">
        </mwl-calendar-month-view>
        <mwl-calendar-week-view [locale]="pt-BR" *ngSwitchCase="'week'" [viewDate]="viewDate" [events]="events" (eventClicked)="editSchedule($event.event, true)">
        </mwl-calendar-week-view>
        <mwl-calendar-day-view [locale]="pt-BR" *ngSwitchCase="'day'" [viewDate]="viewDate" [events]="events" (eventClicked)="editSchedule($event.event, true)">
        </mwl-calendar-day-view>
      </div>

Is there some bug? or Did I forget to put something?

Thank's

Most helpful comment

You are passing the variable pt-BR not the string. You either need to do locale="pt-BR" or [locale]="'pt-BR'". Hope that helps 馃槃

>All comments

You are passing the variable pt-BR not the string. You either need to do locale="pt-BR" or [locale]="'pt-BR'". Hope that helps 馃槃

Was this page helpful?
0 / 5 - 0 ratings