From 67acb2cabee81c40bdcfad9a59c95280e307d16c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=BA=86=E6=B3=89?= Date: Fri, 31 May 2024 17:17:05 +0800 Subject: [PATCH] Update date.md --- docs/uts/buildin-object-api/date.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/uts/buildin-object-api/date.md b/docs/uts/buildin-object-api/date.md index 310ffa83..edf84017 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() -- GitLab