diff --git a/uni_modules/uts-tests/utssdk/Date.uts b/uni_modules/uts-tests/utssdk/Date.uts index 836fc1bd189c351a242d6847dc0eab48162c1e4d..6543cf8ed3146040c56ad5c2ef637f4b4b2f0af2 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', () => {