rodrigohax

Fecha Envio - Liquid

Jul 28th, 2025
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.51 KB | None | 0 0
  1. <style>
  2.   .custom-shipping-container {
  3.     display: flex;
  4.     padding: 6px 16px;
  5.     justify-content: space-between;
  6.     align-items: center;
  7.     align-self: stretch;
  8.     background-color: #f6f6f6;
  9.     border-radius: 20px;
  10.     margin-top: 10px; /* Agrega espacio en la parte superior */
  11.   }
  12.  
  13.   .custom-shipping-item {
  14.     display: flex;
  15.     align-items: center;
  16.     gap: 6px;
  17.   }
  18.  
  19.   .text-block-shipping {
  20.     font-size: 12px;
  21.     color: #000;
  22.   }
  23.  
  24.   .shipping-date {
  25.     font-weight: bold;
  26.   }
  27.  
  28.   .free-shipping {
  29.     font-weight: bold;
  30.   }
  31.  
  32.   .green-circle {
  33.     animation: fade 1s ease-in-out infinite;
  34.   }
  35.  
  36.   @keyframes fade {
  37.     0%, 100% { opacity: 1; }
  38.     50% { opacity: 0.5; }
  39.   }
  40. </style>
  41.  
  42. <script>
  43.   document.addEventListener("DOMContentLoaded", function() {
  44.     function addBusinessDays(startDate, daysToAdd) {
  45.       let currentDate = new Date(startDate);
  46.       let addedDays = 0;
  47.  
  48.       while (addedDays < daysToAdd) {
  49.        currentDate.setDate(currentDate.getDate() + 1);
  50.        let dayOfWeek = currentDate.getDay();
  51.        if (dayOfWeek !== 0 && dayOfWeek !== 6) { // Excluye domingos (0) y sábados (6)
  52.          addedDays++;
  53.        }
  54.      }
  55.      return currentDate;
  56.    }
  57.  
  58.    var daysAfterToday = 1; // Días hábiles después de hoy
  59.    var today = new Date();
  60.    var shipDate = addBusinessDays(today, daysAfterToday);
  61.  
  62.    // Días de la semana en español
  63.    var daysOfWeek = ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"];
  64.  
  65.    // Formato de fecha en español con el día completo
  66.    var formattedDate = `${daysOfWeek[shipDate.getDay()]} ${shipDate.getDate()} de ${shipDate.toLocaleString('es-ES', { month: 'long' })}`;
  67.  
  68.    document.getElementById('shipping-date').textContent = formattedDate;
  69.  });
  70. </script>
  71.  
  72. <div class="custom-shipping-container">
  73.   <div class="custom-shipping-item">
  74.     <svg class="green-circle" xmlns="http://www.w3.org/2000/svg" width="12" height="13" viewBox="0 0 12 13" fill="none">
  75.       <circle cx="6" cy="6.5" r="6" fill="#137333"/>
  76.     </svg>
  77.     <div class="text-block-shipping">Envío estimado para el <span id="shipping-date" class="shipping-date"></span></div>
  78.   </div>
  79.   <div class="custom-shipping-item">
  80.     <img src="https://upload.wikimedia.org/wikipedia/commons/7/78/Flag_of_Chile.svg" loading="lazy" alt="Bandera de Chile" class="custom-icon" width="16" height="12">
  81.     <div class="text-block-shipping"><span class="free-shipping">Envío GRATIS</span> a todo Chile</div>
  82.   </div>
  83. </div>
Advertisement
Add Comment
Please, Sign In to add comment