Greetings Jamin!
That makes a lot of sense, and as we demonstrated above, ClearScript makes it easy to expose an interface that directly supports JavaScript dates. Your implementation can use them directly or convert them internally to
Regarding your code examples, the first two can't be made to work because JavaScript comparisons can't be redefined or overloaded to operate meaningfully on host objects.
Your third example can be simplified because
Cheers!
I would like to expose a clean interface that leverages the native functionality in JavaScript including Date. This is important because I'm prioritizing the JavaScript syntax over the work it would take to accomplish it on the .NET side.
That makes a lot of sense, and as we demonstrated above, ClearScript makes it easy to expose an interface that directly supports JavaScript dates. Your implementation can use them directly or convert them internally to
DateTime
structures if necessary.Regarding your code examples, the first two can't be made to work because JavaScript comparisons can't be redefined or overloaded to operate meaningfully on host objects.
Your third example can be simplified because
DateTime
already has a comparison method:// JavaScriptvar todayAfterYesterday = now.CompareTo(yesterday) > 0; var todayAfterTomorrow = now.CompareTo(tomorrow) > 0;