From b04faecde400b8051908393d81c71cef0c48c4ad Mon Sep 17 00:00:00 2001 From: duqingquan Date: Fri, 21 Jul 2023 12:14:51 +0800 Subject: [PATCH] =?UTF-8?q?add=20date.parse=20=E6=B5=8B=E8=AF=95=E7=A4=BA?= =?UTF-8?q?=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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/uni_modules/uts-tests/utssdk/Date.uts b/uni_modules/uts-tests/utssdk/Date.uts index 8fac465..d5c734b 100644 --- a/uni_modules/uts-tests/utssdk/Date.uts +++ b/uni_modules/uts-tests/utssdk/Date.uts @@ -16,6 +16,13 @@ export function testDate() : Result { const date2 = new Date('1995-12-17T03:24:00'); expect(date2.valueOf()).toEqual(819141840000); }) + test('parse', () => { + const unixTimeZero = Date.parse('01 Jan 1970 00:00:00 GMT'); + const javaScriptRelease = Date.parse('04 Dec 1995 00:12:00 GMT'); + + expect(unixTimeZero.toString()).toEqual("Thu Jan 01 1970 08:00:00 GMT+0800"); + expect(javaScriptRelease.toString()).toEqual("Mon Dec 04 1995 08:12:00 GMT+0800"); + }) test('getDate', () => { const birthday = new Date('August 19, 1975 23:15:30'); const date1 = birthday.getDate(); -- GitLab