Skip to content

Commit

Permalink
Add timestamp (#336)
Browse files Browse the repository at this point in the history
* add timestamp to entry

* add timestamps to mock data
  • Loading branch information
dayhaysoos authored Nov 30, 2023
1 parent bc08e1c commit d33b6b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions use-shopping-cart/core/Entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function Entry({ id, product, quantity, price_metadata, product_metadata }) {
id,
quantity,
value: product.price * quantity,
timestamp: new Date().toISOString(), // add a timestamp in ISO 8601 format
price_data: {
...product.price_data,
...price_metadata
Expand Down
2 changes: 2 additions & 0 deletions use-shopping-cart/core/slice.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function mockCartDetails(overrides1, overrides2) {
formattedValue: '$8.00',
price_data: {},
product_data: {},
timestamp: new Date().toISOString(),
...overrides1
},
[`id_efg${counter}`]: {
Expand All @@ -41,6 +42,7 @@ function mockCartDetails(overrides1, overrides2) {
formattedValue: '$10.00',
price_data: {},
product_data: {},
timestamp: new Date().toISOString(),
...overrides2
}
}
Expand Down

0 comments on commit d33b6b7

Please sign in to comment.