From d4e508f5baa81d7e8c759d88928b8208261be344 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Mon, 6 May 2024 18:09:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=83=A8=E5=88=86=20new=20Da?= =?UTF-8?q?te=20=E6=B5=8B=E8=AF=95=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uts-tests/utssdk/Date.uts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/uni_modules/uts-tests/utssdk/Date.uts b/uni_modules/uts-tests/utssdk/Date.uts index 836fc1b..6543cf8 100644 --- a/uni_modules/uts-tests/utssdk/Date.uts +++ b/uni_modules/uts-tests/utssdk/Date.uts @@ -63,6 +63,20 @@ export function testDate() : Result { expect(event2.toDateString()).toEqual("Thu Jan 09 2014"); // #endif }) + + + test('newDateTest', () => { + // #ifdef APP-ANDROID + console.log(new Date("2024/5/1").toString()) + expect(new Date("2024/5/1").toString()).toEqual("Wed May 01 2024 00:00:00 GMT+0800"); + expect(new Date("2024/5/1 10:00:00").toString()).toEqual("Wed May 01 2024 10:00:00 GMT+0800"); + expect(new Date("2024-05-01 10:00:00").toString()).toEqual("Wed May 01 2024 10:00:00 GMT+0800"); + expect(new Date("2024-05-01 11:00").toString()).toEqual("Wed May 01 2024 11:00:00 GMT+0800"); + expect(new Date("2024/05/01 12:00").toString()).toEqual("Wed May 01 2024 12:00:00 GMT+0800"); + expect(new Date("2024-5-1 10:00").toString()).toEqual("Wed May 01 2024 10:00:00 GMT+0800"); + expect(new Date("2024/5/1 10:00").toString()).toEqual("Wed May 01 2024 10:00:00 GMT+0800"); + // #endif + }) test('getDate', () => { -- GitLab