mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-31 01:11:06 +00:00
fix(js) Use f64
instead of Number
.
This commit is contained in:
parent
fe4c150431
commit
df5fec22d9
@ -684,7 +684,7 @@ extern "C" {
|
|||||||
///
|
///
|
||||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now
|
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now
|
||||||
#[wasm_bindgen(static_method_of = Date)]
|
#[wasm_bindgen(static_method_of = Date)]
|
||||||
pub fn now() -> Number;
|
pub fn now() -> f64;
|
||||||
|
|
||||||
/// The toDateString() method returns the date portion of a Date object
|
/// The toDateString() method returns the date portion of a Date object
|
||||||
/// in human readable form in American English.
|
/// in human readable form in American English.
|
||||||
@ -771,7 +771,7 @@ extern "C" {
|
|||||||
///
|
///
|
||||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/UTC
|
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/UTC
|
||||||
#[wasm_bindgen(static_method_of = Date, js_name = UTC)]
|
#[wasm_bindgen(static_method_of = Date, js_name = UTC)]
|
||||||
pub fn utc(year: Number, month: Number) -> Number;
|
pub fn utc(year: f64, month: f64) -> f64;
|
||||||
|
|
||||||
/// The valueOf() method returns the primitive value of
|
/// The valueOf() method returns the primitive value of
|
||||||
/// a Date object.
|
/// a Date object.
|
||||||
|
@ -42,10 +42,10 @@ fn now() {
|
|||||||
|
|
||||||
extern crate wasm_bindgen;
|
extern crate wasm_bindgen;
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
use wasm_bindgen::js::{Date, Number};
|
use wasm_bindgen::js::Date;
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn now() -> Number {
|
pub fn now() -> f64 {
|
||||||
Date::now()
|
Date::now()
|
||||||
}
|
}
|
||||||
"#)
|
"#)
|
||||||
@ -360,11 +360,11 @@ fn utc() {
|
|||||||
|
|
||||||
extern crate wasm_bindgen;
|
extern crate wasm_bindgen;
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
use wasm_bindgen::js::{Date, Number};
|
use wasm_bindgen::js::Date;
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn utc() -> Number {
|
pub fn utc() -> f64 {
|
||||||
Date::utc(Number::new(JsValue::from(2018)), Number::new(JsValue::from(6)))
|
Date::utc(2018f64, 6f64)
|
||||||
}
|
}
|
||||||
"#)
|
"#)
|
||||||
.file("test.ts", r#"
|
.file("test.ts", r#"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user