Custom Binding expression

Hi fuse,

I need custom expression like this;


       //some operation

      return val;

<Text Value="{= formatDate({processDate},'dd MM YYYY') }" />

Is something like this possible?

Hi Hilmi,

there is no ready UX expression for formatting date, but it looks like you have already figured out that you could use JavaScript to achieve what you wanted. Let’s take it a step further and make it work!

	var Observable = require("FuseJS/Observable");
	var date = Observable("some_date_string_here");

	function formatDate(val, format) {
		// some operation

	var formatted = {
		return formatDate(x, 'dd MM YYYY');

	// TODO:
	// 1: change the date.value when you need to process a new value.
	// 2: done. the variable "formatted" updates reactively every time "date" observable changes.
	date.value = "some_other_date_string";

	module.exports = {
		formatted: formatted
<Text Value="{formatted}" />

Hope this helps!

Hi Uldis,

Thanks for reply, but i have many rows in data formatted foreach loop take a long time.


Any idea?

Hi Hilmi,

you should probably do the date formatting when you first read the data, before you stuff it in the observable. That way, the formatted date will already be there and no run-time mapping will be required.