我想把日期注入到shopify description产品的html中
它会说
我们将从今天起+ 11天内发货.
如果是星期六或者星期天的话就会移到星期一,因为星期六或者星期天是休息日。
代码现在是这样的,但是如果需要的话,不知道如何把它移到第一个星期一
// get the destination within the DOM
var wrapper = document.getElementById('productEta'),
// get today as a js Date object
today = new Date(),
// get the Unix of today (miliseconds) and add desired time (3 weeks)
etaUnix = today.getTime() + (60 * 60 * 24 * 11 * 1000),
// convert the new time to date object and then to a human readable string
etaForHumans = new Date(etaUnix).toDateString();
// set the destination inner html to be what it already is
// plus a space and the human readable string.
wrapper.innerHTML += ' ' + etaForHumans;
<div id="productEta">Product will arrive by: </div>
但是脚本也有问题
https://stackoverflow.com/questions/54936334
复制相似问题