特定事件后停止Podio计算

时间:2017-02-10 18:29:22

标签: podio

我们目前有一个计数器,从"报名日期"今天"今天"几个星期。

我们希望在一个单独的字段("优惠已发送")更新后停止计算的几周。

这可能吗?

1 个答案:

答案 0 :(得分:0)

有几种方法可以解决这个问题。这是一个例子。因此,Podio应用程序有2个字段,Date设置日期和时间,Category有多个选项,可显示如何处理日期和时间。

var category = @Category;
var now = new Date;
var today = new Date;
today.setHours(0, 0, 0, 0);
var durationTillNow = (now - @Date)/1000/60/60/24;
var fromDate = @Date;
fromDate.setHours(0, 0, 0, 0);
var durationTillNowWithoutTime = (today - fromDate)/1000/60/60/24;

if (category == 'round to nearest number') {
  "Rounded to: " + Math.round(durationTillNow).toString() + " day(s)";
} else if (category == 'round up') {
  "Round up: " + Math.ceil(durationTillNow).toString() + " day(s)";
} else if (category == 'round down') {
  "Round down: " + Math.floor(durationTillNow).toString() + " day(s)";
} else if (category == 'show full diff') {
  "Full diff: " + durationTillNow.toString() + " day(s)";
} else if (category == 'just ignore time') {
  "Ignoring time part: " + durationTillNowWithoutTime.toString() + " day(s)";

} else if (category == 'something else') {
 "it's something else selected";
} else {
  "yet another else option selected";
}