Wednesday, January 16, 2013

JSON ISO 8601 date formatting, Kendo MVVM using Kendo templates

Here is a quick tip how to bind to JSON ISO 8601 date.

Parsing and formatting to local date is done using Kendo framework.

	<div data-bind="source: expirationDate" data-template="format-date-template"></div>

	<script id="format-date-template" type="text/x-kendo-template">
	<span>#: kendo.toString(kendo.parseDate(data),"d") #</span>
	</script>

and add the warning icon if expired:

	# if (kendo.parseDate(data) < (new Date())) { #
		<span class="icon warning" title="Expired"><span>
	# } #
Links:
Kendo UI
Kendo Templating
Kendo Globalization Date helpers

1 comment:

Sterling International Consulting said...

I read the above article and I got some knowledge from your article. It's actually great and useful data for us. Thanks for share it.ISO certification in UAE