2

Was wondering if it is possible to format a date in a column using a property. E.g:

<kendo-grid-column field="DOB" format="{0:d}" title="DOB" width="160"  >
    </kendo-grid-column>

I would like to format the DOB using a property. In my TS file I would have something like:

shortDate="dd/mm/yyyy"

In HTML:

<kendo-grid-column field="DOB" format="{0:shortDate}" title="DOB" width="160"  >
    </kendo-grid-column>

Something like that possible?

Thanks,

2 Answers 2

5

Solution I ended up using:

<kendo-grid-column field="DOB" title="DOB" width="160" >
        <ng-template kendoGridCellTemplate let-dataItem>
            {{dataItem.DOB | date:config.ShortDate}}
        </ng-template>
    </kendo-grid-column>
Sign up to request clarification or add additional context in comments.

Comments

-1

For anyone in future's use, You can easily format it using below format property as below

<kendo-grid-column title="Received On" field="labReceivedDate" format="{0: dd MMM yyyy}" width="120px "></kendo-grid-column>

1 Comment

The idea was to store the formatiing in an external file, not in the column itself. So that you would only have to change it in in place and not in all columns seperately.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.