From 8ac689a6face4eb52feb48933c626316b8beb44f Mon Sep 17 00:00:00 2001 From: Dmitriy Shekhovtsov Date: Fri, 1 Sep 2017 17:10:48 +0300 Subject: [PATCH] feat(datepicker): added locale option to Datepicker Configuration (#2560) * feat(datepicker): added locale option to Datepicker Configuration fixes #455 --- src/datepicker/date-formatter.ts | 4 ++-- src/datepicker/datepicker-inner.component.ts | 3 ++- src/datepicker/datepicker.component.ts | 1 + src/datepicker/datepicker.config.ts | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/datepicker/date-formatter.ts b/src/datepicker/date-formatter.ts index 027d0afc84..e1bee80371 100644 --- a/src/datepicker/date-formatter.ts +++ b/src/datepicker/date-formatter.ts @@ -1,7 +1,7 @@ import { formatDate } from '../bs-moment/format'; export class DateFormatter { - public format(date: Date, format: string): string { - return formatDate(date, format); + public format(date: Date, format: string, locale: string): string { + return formatDate(date, format, locale); } } diff --git a/src/datepicker/datepicker-inner.component.ts b/src/datepicker/datepicker-inner.component.ts index a14c4d62a9..e35f42ef93 100644 --- a/src/datepicker/datepicker-inner.component.ts +++ b/src/datepicker/datepicker-inner.component.ts @@ -31,6 +31,7 @@ import { DateFormatter } from './date-formatter'; ` }) export class DatePickerInnerComponent implements OnInit, OnChanges { + @Input() locale: string; @Input() public datepickerMode: string; @Input() public startingDay: number; @Input() public yearRange: number; @@ -181,7 +182,7 @@ export class DatePickerInnerComponent implements OnInit, OnChanges { } public dateFilter(date: Date, format: string): string { - return this.dateFormatter.format(date, format); + return this.dateFormatter.format(date, format, this.locale); } public isActive(dateObject: any): boolean { diff --git a/src/datepicker/datepicker.component.ts b/src/datepicker/datepicker.component.ts index 26f67376c7..2e9aa352bf 100644 --- a/src/datepicker/datepicker.component.ts +++ b/src/datepicker/datepicker.component.ts @@ -15,6 +15,7 @@ export const DATEPICKER_CONTROL_VALUE_ACCESSOR: any = { template: `