Search code examples
angulardatekendo-uigridkendo-ui-angular2

Kendo Angular Parse month number to month name


how can i display month names without converting each month number via a function

this is my kendo grid with month column:

<kendo-grid-column field="month">
        <ng-template kendoGridCellTemplate let-dataItem="dataItem">
                <span>{{convertMonthNToName(dataItem)}}</span>
        </ng-template>
</kendo-grid-column>

the function convertMonthNToName contains a switch that returns a string month name

Is there anything kendo preset that does this? via a parse or via culture libraries


Solution

  • If perceived well, please use DatePipe and try the following:

    <kendo-grid-column field="month">
         <ng-template kendoGridCellTemplate let-dataItem="dataItem">
                 <span>{{dataItem | date: 'MMMM'}}</span>
         </ng-template>
    </kendo-grid-column>
    

    Please provide some stackblitz demo to make it more specific.