You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use the Substract member on System.DateTime and noticed that it is transpiled to subtract and imported by from fable_modules.fable_library.date import (now, subtract). If i go into this file i can find the following code, which seems right:
# fable_modules.fable_library.datedefop_subtraction(x: datetime, y: datetime) ->TimeSpan:
delta=x-y# ts.microseconds only contains the microseconds provided to the constructor# so we need to calculate the total microseconds ourselvesdelta_microseconds=delta.days* (24*3600) +delta.seconds*10**6+delta.microsecondsreturncreate_time_span(0, 0, 0, 0, 0, delta_microseconds)
So my guess is it should be transpiled to op_subtraction, instead of subtract.
Repro code
#r "nuget: Fable.Core, 4.2.0"openFable.CoreopenSystem[<AttachMembersAttribute>]typeStopwatch()=member valStartTime:DateTime option = None with get, set
member valStopTime:DateTime option = None with get, set
memberthis.Start()= this.StartTime <- Some DateTime.Now
memberthis.Stop()=match this.StartTime with| Some _-> this.StopTime <- Some DateTime.Now
| None -> failwith "Error. Unable to call `Stop` before `Start`."memberthis.Elapsed=match this.StartTime, this.StopTime with| Some start, Some stop -> stop.Subtract(start)|_,_-> failwith "Error. Unable to call `Elapsed` without calling `Start` and `Stop` before."lettestFunc()=letstopwatch=new Stopwatch()
stopwatch.Start()
System.Threading.Thread.Sleep(2000)
stopwatch.Stop()
stopwatch.Elapsed
testFunc().ToString()|> printfn "%s"
Related information
Fable version: 4.6.0
The text was updated successfully, but these errors were encountered:
Description
I want to use the
Substract
member on System.DateTime and noticed that it is transpiled tosubtract
and imported byfrom fable_modules.fable_library.date import (now, subtract)
. If i go into this file i can find the following code, which seems right:So my guess is it should be transpiled to
op_subtraction
, instead ofsubtract
.Repro code
Related information
4.6.0
The text was updated successfully, but these errors were encountered: