Reputation: 1959
For our Angular 4 application I'm using ngx-translate with messageformat.js for handling internationalization and localization. Is it possible to get the format string of shortdate of a date object ie. 'YYYY-MM-dd'?
ie: new Date().formatString('en-US')
returns: 'YYYY-MM-dd'
Upvotes: 1
Views: 127
Reputation: 245
const pipe: DatePipe = new DatePipe(locale) //en-Ukr
return pipe.transform(value, 'y-MM-DD') // value = new Date()
'2017-12-04'
Upvotes: -1