LoginSignup
4
4

More than 5 years have passed since last update.

D3.jsで"+09:00"がパースできない件

Last updated at Posted at 2014-07-24
var dateString = "2014-07-23T00:00:00.000+09:00";

var wrongFormat = d3.time.format("%Y-%m-%dT%H:%M:%S.%L%Z");
wrongFormat.parse(dateString); //=> null

var rightFormat = d3.time.format("%Y-%m-%dT%H:%M:%S.%L+09:00");
rightFormat.parse(dateString); //=> Date

タイムゾーンを表す%Z+0900のようなフォーマットはパースできるけど、:が含まれるとパースできない。上のようにしたら解決した。

参考

4
4
0

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
4
4