最近搜索
没有最近搜索

James McGahn
已加入2021年4月16日
·
最后活动2021年10月27日
关注
0
关注者
0
活动总数
4
投票
1
订阅
1
活动概览
标记
文章
帖子
社区评论
文章评论
活动概览
的最新活动 James McGahn
James McGahn 进行了评论,
@...
You want it to count three days in the future but not the weekends? If so, try out the below
Assigns today -> the day of the week
If wed -> then add 5 days in seconds to now == mon
if thurs -> then add 4 days in seconds to now == mon
else -> add 3 days in seconds to now
{% assign today = 'now' | date: '%A' %}
{% if today == 'Wednesday' %}
{{ 'now' | date: '%s' | plus:432000 | date: '%Y-%m-%d' }}
{% elsif today == 'Thursday' %}
{{ 'now' | date: '%s' | plus:345600 | date: '%Y-%m-%d' }}
{% else %}
{{ 'now' | date: '%s' | plus:259200 | date: '%Y-%m-%d' }}
{% endif %}
查看评论 · 已于 2020年7月16日 发布 · James McGahn
0
关注者
0
投票
0
评论
James McGahn 进行了评论,
@...
there may be a simpler way to do it but this should work
finds day of week, minuses day of the week from 7. takes that calculates the seconds and then adds that to the current date.
test it out
{% assign today = 'now' | date: '%u' %}{% assign dayWeek = 7 | minus: today %}
{% assign seconds = dayWeek | times: 24 | times: 60 | times: 60 %}
{{ 'now' | date: '%s' | plus: seconds | date: '%Y-%m-%d' }}
查看评论 · 已于 2020年6月05日 发布 · James McGahn
0
关注者
0
投票
0
评论