mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-22 03:01:55 +00:00
Improve date binding compatibility
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
export declare function UTC(
|
||||
// NOTE: Using i32 below saves us a f64.convert_s instruction and moves the responsibility for
|
||||
// converting the value to the WASM/JS boundary.
|
||||
year: i32,
|
||||
month: i32,
|
||||
day: i32,
|
||||
hour: i32,
|
||||
minute: i32,
|
||||
second: i32,
|
||||
millisecond: i32
|
||||
millisecond: f64
|
||||
): f64;
|
||||
export declare function now(): f64;
|
||||
|
@ -12,9 +12,9 @@ export class Date {
|
||||
hour: i32 = 0,
|
||||
minute: i32 = 0,
|
||||
second: i32 = 0,
|
||||
millisecond: i32 = 0
|
||||
millisecond: i64 = 0
|
||||
): i64 {
|
||||
return <i64>Date_UTC(year, month, day, hour, minute, second, millisecond);
|
||||
return <i64>Date_UTC(year, month, day, hour, minute, second, <f64>millisecond);
|
||||
}
|
||||
|
||||
@inline static now(): i64 {
|
||||
@ -31,7 +31,8 @@ export class Date {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
setTime(value: i64): void {
|
||||
setTime(value: i64): i64 {
|
||||
this.value = value;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
2
std/assembly/index.d.ts
vendored
2
std/assembly/index.d.ts
vendored
@ -675,7 +675,7 @@ declare class Date {
|
||||
/** Returns the UTC timestamp of this date in milliseconds. */
|
||||
getTime(): i64;
|
||||
/** Sets the UTC timestamp of this date in milliseconds. */
|
||||
setTime(value: i64): void;
|
||||
setTime(value: i64): i64;
|
||||
}
|
||||
|
||||
/** Environmental tracing function for debugging purposes. */
|
||||
|
2
std/portable/index.d.ts
vendored
2
std/portable/index.d.ts
vendored
@ -442,7 +442,7 @@ declare class Date {
|
||||
/** Returns the UTC timestamp of this date in milliseconds. */
|
||||
getTime(): number;
|
||||
/** Sets the UTC timestamp of this date in milliseconds. */
|
||||
setTime(value: number): void;
|
||||
setTime(value: number): number;
|
||||
}
|
||||
|
||||
declare namespace console {
|
||||
|
Reference in New Issue
Block a user