Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add timestamp #336

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions use-shopping-cart/core/Entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,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
Loading