diff --git a/docs/uts/buildin-object-api/date.md b/docs/uts/buildin-object-api/date.md index 310ffa831fa1aef269ff9c7fec136cbfc2b6157f..edf840178a8511c7223883e0bb0012ca7310f0e0 100644 --- a/docs/uts/buildin-object-api/date.md +++ b/docs/uts/buildin-object-api/date.md @@ -35,6 +35,21 @@ new Date(year, monthIndex [, day [, hours [, minutes [, seconds [, milliseconds] + 2024-5-1 00:00 (HBuilder X 4.18 Android/Web 支持) + 2024/5/1 00:00 (HBuilder X 4.18 Android/Web 支持) +如果传入Date构造器的参数字符串不合法,在web平台会抛出 "Invalid Date" 异常 + +```ts +// Invalid Date +new Date("Hello") +``` + +在Android/IOS平台,会转换为程序执行时的时间 + +```ts +// ‍当前日期:[Date]‍ Fri May 31 2024 17:18:02 GMT+0800 +new Date("Hello") +``` + + ## 静态方法 ### now()