You can use .JS on a System.DateTime to get the equivalent JavaScript.Date.

More generally, you can use .JS on a .NET type to get the closest native JavaScript equivalent: DateTime gives Date, array gives Array, string gives String, numeric types give Number, and everything else gives Object. .Self does the reverse conversion. Only the DateTime <-> Date conversions do any work, all the others are just no-op "casts".

By on 12/14/2016 6:33 AM ()

DateTime is proxied as a JS Number so it can be used for remoting. Although I have been seeing some weird behavior in DateTime remoting when server is in another timezone, I will need to investigate further.

I also don't know a better way than new Date($date) that's what most DateTime method proxies are doing: example

In F#, you can do d.JS.ToUTCString(), this will be translated similarly.

By on 12/14/2016 6:31 AM ()

Hi AndrĂ¡s, thanks I will then go for new Date($date).

By on 12/14/2016 7:17 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper