How and is it possible to change date format when filtering by date?
<p-columnFilter type="date" [field]="col.field" display="menu">
Default format is mm/dd/yyyy but I want to achieve dd/mm/yyyy
You can do this by configuring the PrimeNgConfig:
in your i18n assets (could also be just a typescript constant):
"primeng": {
...
"dateFormat": "dd.mm.yy",
...
}
Then inject PrimeNgConfig
in your app components constructor:
private primeNgConfig: PrimeNGConfig
In ngOnInit you can set the configuration:
this.translate.get('primeng').subscribe(res => this.primeNgConfig.setTranslation(res))
More documentation on here: https://www.primefaces.org/primeng/i18n
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With