Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: display date and time in some vouchers #2618

Merged
merged 4 commits into from Apr 8, 2024

Conversation

m1aw
Copy link
Contributor

@m1aw m1aw commented Mar 26, 2024

Summary

For some voucher like Econtext and Dragon pay we shuold display expiration time together with the date.
Created a new i18n function to format dateTime. Also make a tittle change to make sure we are not creating a new formatter every time as it's a slow operation (according MDN).

Tested scenarios

  • Tested with the mock data in the playground
  • Still needs a test with the 2 payment methods test data

Fixed issue:
COWEB-1297, COWEB-1359

Copy link

changeset-bot bot commented Mar 26, 2024

🦋 Changeset detected

Latest commit: 3b2c73c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@adyen/adyen-web Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Mar 27, 2024

Size Change: +437 B (0%)

Total Size: 1.14 MB

Filename Size Change
packages/lib/dist/adyen.js 302 kB +142 B (0%)
packages/lib/dist/cjs/index.js 263 kB +99 B (0%)
packages/lib/dist/es.modern/index.js 126 kB +110 B (0%)
packages/lib/dist/es/index.js 146 kB +86 B (0%)
ℹ️ View Unchanged
Filename Size
packages/lib/dist/es.modern/ar.js 6.95 kB
packages/lib/dist/es.modern/cs-CZ.js 6.19 kB
packages/lib/dist/es.modern/da-DK.js 5.62 kB
packages/lib/dist/es.modern/de-DE.js 6.09 kB
packages/lib/dist/es.modern/el-GR.js 7.91 kB
packages/lib/dist/es.modern/es-ES.js 5.73 kB
packages/lib/dist/es.modern/fi-FI.js 5.73 kB
packages/lib/dist/es.modern/fr-FR.js 5.96 kB
packages/lib/dist/es.modern/hr-HR.js 5.99 kB
packages/lib/dist/es.modern/hu-HU.js 6.27 kB
packages/lib/dist/es.modern/it-IT.js 5.81 kB
packages/lib/dist/es.modern/ja-JP.js 6.69 kB
packages/lib/dist/es.modern/ko-KR.js 6.32 kB
packages/lib/dist/es.modern/nl-NL.js 5.76 kB
packages/lib/dist/es.modern/no-NO.js 5.58 kB
packages/lib/dist/es.modern/pl-PL.js 6.27 kB
packages/lib/dist/es.modern/pt-BR.js 5.78 kB
packages/lib/dist/es.modern/pt-PT.js 5.91 kB
packages/lib/dist/es.modern/ro-RO.js 6.05 kB
packages/lib/dist/es.modern/ru-RU.js 7.39 kB
packages/lib/dist/es.modern/sk-SK.js 6.36 kB
packages/lib/dist/es.modern/sl-SI.js 5.91 kB
packages/lib/dist/es.modern/sv-SE.js 5.59 kB
packages/lib/dist/es.modern/zh-CN.js 6.13 kB
packages/lib/dist/es.modern/zh-TW.js 6.22 kB
packages/lib/dist/es/ar.js 6.95 kB
packages/lib/dist/es/cs-CZ.js 6.19 kB
packages/lib/dist/es/da-DK.js 5.62 kB
packages/lib/dist/es/de-DE.js 6.09 kB
packages/lib/dist/es/el-GR.js 7.91 kB
packages/lib/dist/es/es-ES.js 5.73 kB
packages/lib/dist/es/fi-FI.js 5.73 kB
packages/lib/dist/es/fr-FR.js 5.96 kB
packages/lib/dist/es/hr-HR.js 5.99 kB
packages/lib/dist/es/hu-HU.js 6.27 kB
packages/lib/dist/es/it-IT.js 5.81 kB
packages/lib/dist/es/ja-JP.js 6.69 kB
packages/lib/dist/es/ko-KR.js 6.32 kB
packages/lib/dist/es/nl-NL.js 5.76 kB
packages/lib/dist/es/no-NO.js 5.58 kB
packages/lib/dist/es/pl-PL.js 6.27 kB
packages/lib/dist/es/pt-BR.js 5.78 kB
packages/lib/dist/es/pt-PT.js 5.91 kB
packages/lib/dist/es/ro-RO.js 6.05 kB
packages/lib/dist/es/ru-RU.js 7.39 kB
packages/lib/dist/es/sk-SK.js 6.36 kB
packages/lib/dist/es/sl-SI.js 5.91 kB
packages/lib/dist/es/sv-SE.js 5.59 kB
packages/lib/dist/es/zh-CN.js 6.13 kB
packages/lib/dist/es/zh-TW.js 6.22 kB

compressed-size-action

Copy link

sonarcloud bot commented Mar 28, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
50.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@sponglord
Copy link
Contributor

How did you test that this works with expiration dates/times from different time zones?

@@ -25,7 +25,7 @@ export default function DragonpayVoucherResult(props: DragonpayVoucherResultProp
surcharge={surcharge && i18n.amount(surcharge.value, surcharge.currency)}
voucherDetails={
[
{ label: i18n.get('voucher.expirationDate'), value: i18n.date(expiresAt) },
{ label: i18n.get('voucher.expirationDate'), value: i18n.dateTime(expiresAt) },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that the expiresAt will always be a date & time value? What happens if it's still just a date only?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will always be there since the backend is sending a ISO date. It could be wrong but then it's something on backend/acquiring side.

@m1aw m1aw merged commit 57bacc7 into main Apr 8, 2024
9 of 10 checks passed
@m1aw m1aw deleted the fix/vouchers-econtext-date-and-time branch April 8, 2024 14:06
@github-actions github-actions bot mentioned this pull request Apr 8, 2024
m1aw added a commit that referenced this pull request Apr 15, 2024
* fix: display date and time in some vouhcers

* fix imports

* fix locale issue

* adds safety checks

(cherry picked from commit 57bacc7)
m1aw added a commit that referenced this pull request Apr 15, 2024
* fix: display date and time in some vouhcers

* fix imports

* fix locale issue

* adds safety checks

(cherry picked from commit 57bacc7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants