5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

new Date('YYYY-MM-DD')の時間

Posted at

date-fnsのparse('YYYY-MM-DD')で生成した日付オブジェクトが0時0分0秒に対して、new Date('YYYY-MM-DD')で作成した日付オブジェクトの時間が日本時間9時になります。
日付比較などに使う時に注意する必要があります。

parse

console.log(parse('1989-01-08'));
// Sun Jan 08 1989 00:00:00 GMT+0900 (JST)

new Date

console.log(new Date('1989-01-08'));
// Sun Jan 08 1989 09:00:00 GMT+0900 (JST)
5
0
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?