antvis/G2


The issue has been closed
[v5 & v4] TypeError: Invalid Time: 2022-12-07 00 in time scale! #4454
Valar103769 posted onGitHub
v4 或者v5 有提供用户添入时间格式的地方吗?
目前只看到一个mask,用来format的
对于 2022-12-07 00
这种日期,
为了降低使用复杂度, 能不能内部只处理 new Date的日期,
对于字符串类型的日期, 提供地方让我们自己传入对应的format,
即dayjs之类的库第二个参数, dayjs 这个参数可缺省, 如果缺省之后你们处理不了, 就把format必填
dayjs('2022-12-07 00').isValid() // true
dayjs('2022-12-07 00').format('YYYY-MM-DD HH') // 2022-12-07 00
dayjs('2022-12-07 00').toDate() // Wed Dec 07 2022 00:00:00 GMT+0800 (中国标准时间)
貌似fecha 直接操作date对象并不是很高级, 要是我的话, 会考虑迁移到dayjs 降低复杂度