提交 b04faecd 编写于 作者: 杜庆泉's avatar 杜庆泉

add date.parse 测试示例

上级 9b780ee8
...@@ -16,6 +16,13 @@ export function testDate() : Result { ...@@ -16,6 +16,13 @@ export function testDate() : Result {
const date2 = new Date('1995-12-17T03:24:00'); const date2 = new Date('1995-12-17T03:24:00');
expect(date2.valueOf()).toEqual(819141840000); 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', () => { test('getDate', () => {
const birthday = new Date('August 19, 1975 23:15:30'); const birthday = new Date('August 19, 1975 23:15:30');
const date1 = birthday.getDate(); const date1 = birthday.getDate();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册