From 3b36e9236494185316ae237c12c113371d30d128 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Wed, 17 Apr 2024 17:38:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20Date.toXString=20=E6=B5=8B?= =?UTF-8?q?=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 | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/uni_modules/uts-tests/utssdk/Date.uts b/uni_modules/uts-tests/utssdk/Date.uts index 2b9dd0b..fd80548 100644 --- a/uni_modules/uts-tests/utssdk/Date.uts +++ b/uni_modules/uts-tests/utssdk/Date.uts @@ -44,7 +44,29 @@ export function testDate() : Result { // expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800"); // expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800"); // // #endif - }) + }) + + test('toXString', () => { + const event = new Date('1995-12-17T03:24:00'); + // #ifndef APP-ANDROID + expect(event.toString()).toEqual("Sun Dec 17 1995 03:24:00 GMT+0800"); + expect(event.toTimeString()).toEqual("03:24:00 GMT+0800"); + // #endif + expect(event.toISOString()).toEqual("1995-12-16T19:24:00.000Z"); + expect(event.toJSON()).toEqual("1995-12-16T19:24:00.000Z"); + expect(event.toDateString()).toEqual("Sun Dec 17 1995"); + + const event2 = new Date('2014-01-09 22:00:00'); + // #ifndef APP-ANDROID + expect(event2.toString()).toEqual("Thu Jan 09 2014 22:00:00 GMT+0800"); + expect(event2.toTimeString()).toEqual("2014-01-09T14:00:00.000Z"); + // #endif + expect(event2.toISOString()).toEqual("2014-01-09T14:00:00.000Z"); + expect(event2.toJSON()).toEqual("Thu Jan 09 2014"); + expect(event2.toDateString()).toEqual("22:00:00 GMT+0800"); + + }) + test('getDate', () => { const birthday = new Date('August 19, 1975 23:15:30'); -- GitLab