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(IT Wallet): [SIW-1834] Refactor date claim parser #6431

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

ale-mazz
Copy link
Contributor

@ale-mazz ale-mazz commented Nov 20, 2024

Short description

In this PR, an attempt was made to fix a problem of misalignment of dates from when we receive them from the issuer to when we submit them in the credential claim preview.

List of changes proposed in this pull request

  • Removed localeDateFormat
  • Replaced the date parser with a new SimpleDateFormat type and SimpleDateClaim
  • Checked every claim format and aligned with Figma where necessary
  • Added tests to the parser

How to test

Obtain some credentials to check that the dates are correct, formats are correct, and changing the TZ works as expected.

Thanks @mastro993 for the help and the suggestions.

@pagopa-github-bot
Copy link
Collaborator

pagopa-github-bot commented Nov 20, 2024

Affected stories

  • 🐞 SIW-1834: [io-app] analisi sul parsing

Generated by 🚫 dangerJS against 8037679

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 85.29412% with 5 lines in your changes missing coverage. Please review.

Project coverage is 47.90%. Comparing base (4f204b4) to head (8037679).
Report is 759 commits behind head on master.

Files with missing lines Patch % Lines
.../itwallet/common/components/ItwCredentialClaim.tsx 50.00% 2 Missing ⚠️
...llet/issuance/components/ItwRequiredClaimsList.tsx 0.00% 2 Missing ⚠️
...s/features/itwallet/common/utils/itwClaimsUtils.ts 96.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6431      +/-   ##
==========================================
- Coverage   48.42%   47.90%   -0.53%     
==========================================
  Files        1488     1612     +124     
  Lines       31617    32432     +815     
  Branches     7669     7418     -251     
==========================================
+ Hits        15311    15537     +226     
- Misses      16238    16853     +615     
+ Partials       68       42      -26     
Files with missing lines Coverage Δ
...common/components/ItwSkeumorphicCard/CardClaim.tsx 93.33% <100.00%> (ø)
.../common/components/ItwSkeumorphicCard/CardData.tsx 100.00% <ø> (ø)
ts/utils/dates.ts 78.37% <ø> (-5.23%) ⬇️
...s/features/itwallet/common/utils/itwClaimsUtils.ts 97.27% <96.00%> (ø)
.../itwallet/common/components/ItwCredentialClaim.tsx 63.73% <50.00%> (ø)
...llet/issuance/components/ItwRequiredClaimsList.tsx 11.11% <0.00%> (ø)

... and 1664 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4954500...8037679. Read the comment docs.

---- 🚨 Try these New Features:

Copy link
Contributor

@mastro993 mastro993 left a comment

Choose a reason for hiding this comment

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

I noticed a couple of issues that might need some adjustments:

  1. When requesting an eID, my birthdate is off by two days compared to the real date.
  2. Some tests fail when running with different timezones (e.g., yarn test:tz).

Let me know if you need any help debugging or if you'd like suggestions for potential fixes!

ts/utils/dates.ts Outdated Show resolved Hide resolved
@ale-mazz
Copy link
Contributor Author

I noticed a couple of issues that might need some adjustments:

  1. When requesting an eID, my birthdate is off by two days compared to the real date.
  2. Some tests fail when running with different timezones (e.g., yarn test:tz).

Let me know if you need any help debugging or if you'd like suggestions for potential fixes!

After an analysis done by @mastro993 it was decided to refactor the parser as proposed in this PR. All dependencies related to the parser were aligned, such as date formatting etc etc.

Copy link
Contributor

@mastro993 mastro993 left a comment

Choose a reason for hiding this comment

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

Just a small adjustment needed, and it’ll be good to go from my side!

Comment on lines +270 to +271
const localExpiryDate = claim.expiry_date.toString("DD/MM/YY");
const localIssueDate = claim.issue_date.toString("DD/MM/YY");
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the Figma design, these dates should follow the 'DD/MM/YYYY' format.

Suggested change
const localExpiryDate = claim.expiry_date.toString("DD/MM/YY");
const localIssueDate = claim.issue_date.toString("DD/MM/YY");
const localExpiryDate = claim.expiry_date.toString("DD/MM/YYYY");
const localIssueDate = claim.issue_date.toString("DD/MM/YYYY");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants