<div class="tw-w-full tw-flex tw-items-center tw-mt-4 product-info__marketing-delivery-time {% if section.settings.delivery_time_show_as_date %}product-info__marketing-delivery-time_date{% endif %}" data-delivery-min="{{section.settings.delivery_time_min}}" data-delivery-max="{{section.settings.delivery_time_max}}" >
{% include 'icon_sun_shipping',icon_class:"" %}
<span class="tw-ml-2 tw-leading-none" >
{% if section.settings.delivery_time_show_as_date %}
{{ 'i18n.product.product_detail.marketing_delivery' | t: from: "<b></b>",to:"<b></b>"}}{% else %}{{'i18n.product.product_detail.marketing_delivery_days' | t: from: "<b></b>",to:"<b></b>" }}
{% endif %}
</span>
</div>
<script>
$(function () {
var $delivery = $(".product-info__marketing-delivery-time");
if ($delivery.length) {
var max = $delivery.attr("data-delivery-max");
var min = $delivery.attr("data-delivery-min");
if ($delivery.is(".product-info__marketing-delivery-time_date")) {
var maxdate = new Date((new Date()).getTime() + (max * 86400000));
var mindate = new Date((new Date()).getTime() + (min * 86400000));
var formatter = new Intl.DateTimeFormat('en', { month: 'short', day: "2-digit" });
$delivery.find("b").eq(0).html(formatter.format(mindate))
$delivery.find("b").eq(1).html(formatter.format(maxdate))
} else {
$delivery.find("b").eq(0).html(min);
$delivery.find("b").eq(1).html(max);
}
}
});
</script>
评论 (0)