en mi aplicación tengo descuentos cronometrados (Ejemplo: 10:00 - 12:00), quiero mostrar en una lista estos descuentos activos PERO para los descuentos que también estarán activos mañana y el tiempo de oferta activa ya pasó quiero tienen la palabra MAÑANA junto a ellos, en lugar de HOY.
Cuando uso el momento para ver si la oferta activa ya pasó, no puedo hacer que funcione correctamente...
let activeTableDiscount = null; let activeTableDiscountText = 'TODAY'; let filteredTablesDiscountsToday = { /*same object*/ }; let filteredTablesDiscountTomorrow = {}; var start = moment('10:00', 'HH:mm'); var end = moment('12:00', 'HH:mm'); if (end.isBefore(start)) { // If end is before start, then it must end must be tomorrow. activeTableDiscount = filteredTablesDiscountsToday; activeTableDiscountText = 'TODAY'; } if (now.isBetween(start, end)) { activeTableDiscount = filteredTablesDiscountsToday; activeTableDiscountText = 'TODAY'; } else { if (start.isBefore(now)) { // If start is before now and the range // is not active, then start is tomorrow. //start.add(1, "day"); activeTableDiscount = filteredTablesDiscountsTomorrow; activeTableDiscountText = 'TOMORROW'; } //activeTableDiscount = filteredTablesDiscountsTomorrow; //activeTableDiscountText = 'Hoy'; }¡Gracias por adelantado!