Mapaler / PixivUserBatchDownload

P站画师个人作品批量下载工具,UserScript + Aria2。可高度自定义重命名,发送到本地或远程(如路由器)下载。
GNU General Public License v3.0
1.02k stars 72 forks source link

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

Closed FlareMonso closed 3 years ago

FlareMonso commented 4 years ago

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

Mapaler commented 4 years ago

可能是因为代码升级到严格模式导致的,目前的解决办法就是不要使用以前的简写方式。 %{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会切换写法,目前就这样用着吧