We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It's possible to convert a JS Date object to time.Time with a struct:
Date
time.Time
type foo struct { *js.Object FooTimestamp time.Time `js:"timestamp"` }
But I don't see any way to do it otherwise.
Would it be reasonable to add a Time() method to the *js.Object type to do this, to match Int64(), String(), Bool(), Float(), etc, etc?
Time()
*js.Object
Int64()
String()
Bool()
Float()
I envisage a function signature of:
func (o *Object) Time() time.Time
Which would panic if o is not an instance of JS type Date.
o
The text was updated successfully, but these errors were encountered:
It's possible to convert it directly. See the table at js package docs:
js
Example at https://gopherjs.github.io/playground/#/P7ktYq34Zl.
Sorry, something went wrong.
Oh right. Thanks. Not sure why I overlooked that. 👍
Just to confirm the perhaps obvious: this conversion will remain post #617.
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
It's possible to convert a JS
Date
object totime.Time
with a struct:But I don't see any way to do it otherwise.
Would it be reasonable to add a
Time()
method to the*js.Object
type to do this, to matchInt64()
,String()
,Bool()
,Float()
, etc, etc?I envisage a function signature of:
Which would panic if
o
is not an instance of JS typeDate
.The text was updated successfully, but these errors were encountered: