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

Update the way wl dates are parsed to a string. #655

Merged
merged 1 commit into from
Feb 19, 2021

Conversation

originalname51
Copy link
Contributor

@originalname51 originalname51 commented Feb 19, 2021

Describe the bug
A clear and concise description of what the bug is.
Watchlist Imports Date Without 0

To Reproduce
Steps to reproduce the behavior:
Import watchlist, review wl_item database, review dob field.

Expected behavior
dob field in watchlist item has preceding 0s where appropriate.

e.g. 1982-02-02 instead of 1982-2-2

Additional context
Ticket for GUI
#654
Companion ticket in GTAS
US-CBP/GTAS#2016

A leading 0 must be applied to dates otherwise the fuzzy matching GTAS
uses has an error parsing dates from watchlist items.

A leading 0 must be applied to dates otherwise the fuzzy matching GTAS
uses has an error parsing dates from watchlist items.

  const day = stringDate.getDate(); // use getDate(). getDay() returns
the day of the week
  const month = stringDate.getMonth() + 1; // 0 based
  const year = stringDate.getFullYear();

  to
  const formattedDate = stringDate.getFullYear()
  + '-' + ('0' + (stringDate.getMonth()+1)).slice(-2)
  + '-' + ('0' + stringDate.getDate()).slice(-2);
  return formattedDate;
Copy link
Contributor

@tjwdev tjwdev left a comment

Choose a reason for hiding this comment

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

LGTM

@tjwdev tjwdev merged commit 153e0cb into dev Feb 19, 2021
@KMnOFour KMnOFour deleted the dev_wl_import_fuzzy_match_date_fix branch March 10, 2021 03:03
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.

2 participants