Reputation: 2536
.html
{{2018-02-26T12:00:14.151Z | amParse : 'YYYY/MM/DD' | amDateFormat : 'LL'}}
The above above gives the result as February 26, 2018
but I need the result as
FEBRUARY 2018
.
I am using anular2-moment module link here I have to use this module only.
Upvotes: 2
Views: 264
Reputation: 62596
Angular 2 comes built in with several custom pipes including the UpperCasePipe. To get to the result you want:
{{2018-02-26T12:00:14.151Z | amParse : 'YYYY/MM/DD' | amDateFormat : 'MMMM YYYY' | uppercase}}
Note that the amDateFormat is based on the format in momentjs docs: http://momentjs.com/docs/#/manipulating/add/
The final step is piping the string to UpperCasePipe using '| uppercase': https://angular.io/api/common/UpperCasePipe
Upvotes: 1