Uno datetime parse?

Hi guys,

I’m playing with basic level uno code and i write a tiny expression class number formatter

        [UXFunction("toFormat")]
	public class ToFormat: BinaryOperator
	{
		[UXConstructor]
		public ToFormat(
			[UXParameter("V")] Fuse.Reactive.Expression v,
			[UXParameter("F")] Fuse.Reactive.Expression f) :base(v,f)
		{}
		 
		protected override object Compute(object v,object f)
		{  
			return string.Format(f.ToString(),v);
		}
	}

usage

<JavaScript>
module.exports= {
moneyF:500000.5
};
</JavaScript>

<Text Value="{=toFormat({moneyF},'{0:N1}')}" />

and now a question uno have datetime parse and toString(format) ?

Hi Hilmi,

could these two links help get you started?

https://www.fusetools.com/docs/uno/time/localdatetime

https://www.fusetools.com/docs/uno/time/text/localdatetimepattern

Hi UIdis,

thanks for reply, this is little bit maybe painful (~. ~)
i have another question, is possible uno call js function inside like this;

<JavaScript>
module.exports={
fn:()=>{
    return 555;
}
};
</JavaScript>

<Text Value="{=toDateFormat(44,{fn})}" />
[UXFunction("toDateFormat")]
	public class ToDateFormat: BinaryOperator
	{
		[UXConstructor]
		public ToDateFormat(
			[UXParameter("V")] Fuse.Reactive.Expression v,
			[UXParameter("F")] Fuse.Reactive.Expression f) :base(v,f)
		{}
		 
		protected override object Compute(object v,object f)
		{    
                          var mValue=f();  /* this is possible ? */
			return mValue+v;
		}
	}

Hi Himli, did you get it working??