Authored by ccbikai

专题活动倒计时支持年

... ... @@ -7,6 +7,7 @@
const helpers = global.yoho.helpers;
const timeFormat = {
y: '剩{y}年{d}天',
d: '剩{d}天',
h: '剩{h}小时',
m: '剩{m}分钟',
... ... @@ -18,6 +19,7 @@ const timeFormat = {
};
const anHour = 3600;
const aYear = 31536000;
const aDay = anHour * 24;
/**
... ... @@ -33,7 +35,9 @@ const processTime = (time) => {
data.warnColor = true;
data.time = '低于1小时';
} else {
if (time > aDay) {
if (time > aYear) {
type = 'y';
} else if (time > aDay) {
type = 'dh';
} else {
type = 'h';
... ...