Closed netsrotr closed 5 years ago
AH ok. :)
If you were curious, TimeSpan
inherits from TimeQuanity
and you can compare against any TimeQuantity
:
https://github.com/electricessence/TypeScript.NET/blob/master/source/System/Time/TimeQuantity.ts#L51-L59
@netsrotr I'm glad to see someone using this and doing so in an elegant way as intended. Any thoughts, comments? I'm working on another if not potentially final version of TS .NET as we are moving into a WebAssembly world where this might all become obsolete. 😏
Hi, we use the TimeSpan datatype within our typescript project (typescript-dotnet-commonjs: ^4.11.1).
Now if I use one timespan variable and try to compare to another instance using
.compareTo()
I get an errorxxx.compareTo
is not a function (TypeError). Sample:if (this.time.compareTo(TimeSpan.zero) === 1) ...
where time is of type TimeSpan too.Another issue I have: I Cannot use code like this:
if (this.time.compareTo(TimeSpan.zero) === CompareResult.Greater) ...
because I get webpack require error about CompareResult type not loadable. Further we cannot include the library in our separate library webpack module package because of the missing index file. What are we doing wrong here?Update to issue 1) I work with a JSON object instance of the TimeSpan, so that seems to cause the error(s) about missing functions. Resolved, sorry.