2

.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.

Aditya
  • 2,358
  • 6
  • 35
  • 61

1 Answers1

1

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

Rolando
  • 58,640
  • 98
  • 266
  • 407