Skip to content

Instantly share code, notes, and snippets.

@oieioi
Created January 18, 2019 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oieioi/57b9aa1435f06e70954830d40640d750 to your computer and use it in GitHub Desktop.
Save oieioi/57b9aa1435f06e70954830d40640d750 to your computer and use it in GitHub Desktop.
<input type="date"> のテスト
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>input date test</title>
<style>
input {
width: 100%;
display: block;
width: calc(100% - 20px);
height: 1.5em;
font-size: 2em;
border: 1px solid #ddd;
margin: 10px;
}
</style>
</head>
<body>
<form action="post">
<label>
start-date:
<input type="date" name="start-date">
</label>
<label>
end-date:
<input type="date" name="end-date" min="2019-05-01" max="2019-05-14">
</label>
<label>
other-date:
<input type="date" name="other-date" min="2019-04-01" max="2019-05-14">
</label>
</form>
</body>
</html>
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
await page.goto('http://127.0.0.1/index.html');
// 201901年2月3日になる
await page.type('input[name="start-date"]', "2019-01-23");
// 2019年01月23日になる
await page.type('input[name="start-date"]', "002019-01-23");
// 2019年5月23日になる
await page.type('input[name="end-date"]', "2019-01-23");
// 2019年2月23日になる
await page.type('input[name="other-date"]', "2019-01-23");
await browser.close();
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment