Fix month in JavaScript binding (#84)

In JavaScript, Date.getMonth returns a zero-based value
(where zero indicates the first month of the year).
This commit is contained in:
Yeechan Lu 2020-11-25 16:14:52 +08:00 committed by GitHub
parent 492da8cfca
commit d2dbd1d3d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -80,7 +80,7 @@ impl Context {
#[wasm_bindgen(js_name = setTime)]
pub fn set_time(&mut self, date: Date) {
let year = date.get_utc_full_year();
let month = date.get_utc_month();
let month = date.get_utc_month() + 1;
let day = date.get_utc_date();
let hour = date.get_utc_hours();
let min = date.get_utc_minutes();