js.js 634 B

123456789101112131415161718192021222324
  1. function calcDeliveryTimeRang() {
  2. let interval = 20;
  3. let start = dayjs(this.nowTime);
  4. let takeUpTime = Number(this.sale.billServiceTime);
  5. let min = dayjs(start).add(takeUpTime, "minute");
  6. let max = dayjs(start).add(24, "hour");
  7. let current = min;
  8. let array = [];
  9. do {
  10. current = current.add(interval, "minute");
  11. array.push({
  12. label: current.format("HH:mm"),
  13. value: current.format("YYYY-MM-DD HH:mm"),
  14. });
  15. } while (current.add(interval, "minute").isBefore(dayjs(max)));
  16. array.push({
  17. label: current.format("HH:mm"),
  18. value: current.format("YYYY-MM-DD HH:mm"),
  19. });
  20. return array;
  21. }