Skip to content

Commit d33b6b7

Browse files
authored
Add timestamp (#336)
* add timestamp to entry * add timestamps to mock data
1 parent bc08e1c commit d33b6b7

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

use-shopping-cart/core/Entry.js

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function Entry({ id, product, quantity, price_metadata, product_metadata }) {
5555
id,
5656
quantity,
5757
value: product.price * quantity,
58+
timestamp: new Date().toISOString(), // add a timestamp in ISO 8601 format
5859
price_data: {
5960
...product.price_data,
6061
...price_metadata

use-shopping-cart/core/slice.test.js

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function mockCartDetails(overrides1, overrides2) {
2727
formattedValue: '$8.00',
2828
price_data: {},
2929
product_data: {},
30+
timestamp: new Date().toISOString(),
3031
...overrides1
3132
},
3233
[`id_efg${counter}`]: {
@@ -41,6 +42,7 @@ function mockCartDetails(overrides1, overrides2) {
4142
formattedValue: '$10.00',
4243
price_data: {},
4344
product_data: {},
45+
timestamp: new Date().toISOString(),
4446
...overrides2
4547
}
4648
}

0 commit comments

Comments
 (0)