fix(js) Use f64 instead of Number.

This commit is contained in:
Ivan Enderlin 2018-07-03 14:26:00 +02:00
parent fe4c150431
commit df5fec22d9
No known key found for this signature in database
GPG Key ID: 461F31FCE31F4AAD
2 changed files with 7 additions and 7 deletions

View File

@ -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.

View File

@ -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#"