[ADF-4684] Content Metadata Card dates should be localised (#4944)

* [ADF-4684] Content Metadata Card dates should be localised

* Passed locale param in datePipe
* Set default locale value in card-view-dateitem model
* Updated property locale in card-view-dateitem component on change in language

* * Added test case

* * Added unit test case

* * Removing locale arg from datepipe
This commit is contained in:
mcchrys
2019-07-19 22:20:53 +05:30
committed by Eugenio Romano
parent fc58f1a483
commit 1064b71308
3 changed files with 20 additions and 2 deletions

View File

@@ -71,7 +71,10 @@ export class CardViewDateItemComponent implements OnInit, OnDestroy {
this.userPreferencesService
.select(UserPreferenceValues.Locale)
.pipe(takeUntil(this.onDestroy$))
.subscribe(locale => this.dateAdapter.setLocale(locale));
.subscribe(locale => {
this.dateAdapter.setLocale(locale);
this.property.locale = locale;
});
(<MomentDateAdapter> this.dateAdapter).overrideDisplayFormat = 'MMM DD';

View File

@@ -36,7 +36,7 @@ export class CardViewDateItemModel extends CardViewBaseItemModel implements Card
}
if (cardViewDateItemProperties.locale) {
this.format = cardViewDateItemProperties.locale;
this.locale = cardViewDateItemProperties.locale;
}
}