Skip to content

Commit c88958f

Browse files
committed
import dayjs external library
1 parent 00ac11a commit c88958f

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

basic-projects/amazon-project/scripts/checkout.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {cart, removeFromCart, calculateCartQuantity, updateQuantityLabel} from '../data/cart.js'
22
import {products} from '../data/products.js'
3-
import { formatCurrency } from './utils/price.js';
3+
import formatCurrency from './utils/price.js';
4+
import dayjs from 'https://cdn.jsdelivr.net/npm/dayjs/+esm'
45

56

67
let cartSummaryHTML = ''
@@ -64,7 +65,7 @@ cart.forEach((cartItem) => {
6465
name="delivery-option-${matchingProduct.id}">
6566
<div>
6667
<div class="delivery-option-date">
67-
Tuesday, June 21
68+
${dayjs().add(7, 'days').format('dddd, MMMM D')}
6869
</div>
6970
<div class="delivery-option-price">
7071
FREE Shipping
@@ -76,19 +77,19 @@ cart.forEach((cartItem) => {
7677
name="delivery-option-${matchingProduct.id}">
7778
<div>
7879
<div class="delivery-option-date">
79-
Wednesday, June 15
80+
${dayjs().add(3, 'days').format('dddd, MMMM D')}
8081
</div>
8182
<div class="delivery-option-price">
8283
$4.99 - Shipping
8384
</div>
8485
</div>
8586
</div>
86-
<div class="delivery-option">
87+
<div class="delivery-option js-delivery-option">
8788
<input type="radio" class="delivery-option-input"
8889
name="delivery-option-${matchingProduct.id}">
8990
<div>
9091
<div class="delivery-option-date">
91-
Monday, June 13
92+
${dayjs().add(1, 'days').format('dddd, MMMM D')}
9293
</div>
9394
<div class="delivery-option-price">
9495
$9.99 - Shipping
@@ -171,4 +172,10 @@ document.querySelectorAll('.js-save-link')
171172
saveUpdatedQuantity(itemId);
172173

173174
})
174-
});
175+
});
176+
177+
178+
document.querySelectorAll('.delivery-option-input')
179+
.forEach((input) => {
180+
input
181+
})

0 commit comments

Comments
 (0)