File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -1048,6 +1048,12 @@ extern "C" {
1048
1048
#[ wasm_bindgen( method, js_name = setMilliseconds) ]
1049
1049
pub fn set_milliseconds ( this : & Date , milliseconds : u32 ) -> f64 ;
1050
1050
1051
+ /// The setMinutes() method sets the minutes for a specified date according to local time.
1052
+ ///
1053
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setMinutes
1054
+ #[ wasm_bindgen( method, js_name = setMinutes) ]
1055
+ pub fn set_minutes ( this : & Date , minutes : u32 ) -> f64 ;
1056
+
1051
1057
/// The toDateString() method returns the date portion of a Date object
1052
1058
/// in human readable form in American English.
1053
1059
///
Original file line number Diff line number Diff line change @@ -880,6 +880,45 @@ fn set_milliseconds() {
880
880
. test ( )
881
881
}
882
882
883
+ #[ test]
884
+ fn set_minutes ( ) {
885
+ project ( )
886
+ . file (
887
+ "src/lib.rs" ,
888
+ r#"
889
+ #![feature(proc_macro, wasm_custom_section)]
890
+
891
+ extern crate wasm_bindgen;
892
+ use wasm_bindgen::prelude::*;
893
+ use wasm_bindgen::js::Date;
894
+
895
+ #[wasm_bindgen]
896
+ pub fn set_minutes(this: &Date, minutes: u32) -> f64 {
897
+ this.set_minutes(minutes)
898
+ }
899
+ "# ,
900
+ )
901
+ . file (
902
+ "test.js" ,
903
+ r#"
904
+ import * as assert from "assert";
905
+ import * as wasm from "./out";
906
+
907
+ export function test() {
908
+ let event1 = new Date('August 19, 1975 23:15:30');
909
+ let event2 = new Date('August 19, 1975 23:45:30');
910
+
911
+ let eventMsFromUnixEpoch = wasm.set_minutes(event1, 45);
912
+
913
+ assert.equal(eventMsFromUnixEpoch, 177691530000);
914
+ assert.equal(event1.getTime(), event2.valueOf());
915
+ assert.equal(event1.getMinutes(), 45);
916
+ }
917
+ "# ,
918
+ )
919
+ . test ( )
920
+ }
921
+
883
922
#[ test]
884
923
fn to_date_string ( ) {
885
924
project ( )
You can’t perform that action at this time.
0 commit comments