Mapaler/PixivUserBatchDownload

简写的“作品发布时间”的代码失效了

Closed this issue · 1 comments

%{var dt=new Date(illust.create_date)}%{dt.getFullYear()}年-%{dt.getMonth()+1}月-%{dt.getDate()}日
这段代码输出为“年-月-日”

可能是因为代码升级到严格模式导致的,目前的解决办法就是不要使用以前的简写方式。
%{new Date(illust.create_date).getFullYear()}年-%{new Date(illust.create_date).getMonth()+1}月-%{new Date(illust.create_date).getDate()}日

目前可以简写为
%{(dt=>dt.getFullYear()+"年-"+(dt.getMonth()+1)+"月-"+dt.getDate()+"日")(new Date(illust.create_date))}
学习该写法,你需要了解 立即调用函数表达式箭头函数, 即(function(){})()()=>{}

未来的PUBD6会切换写法,目前就这样用着吧