Skip to content

Commit

Permalink
dob fixes for icbc dl
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinMacaulay committed Nov 30, 2023
1 parent eba1401 commit ec33a23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,16 @@ export const DriverInfo = (props) => {
);
if (values["driver_licence_no"]) {
ICBCDriverDataApi.get(values["driver_licence_no"]).then((resp) => {
console.log(resp);
if (!_.isEmpty(resp.data) && resp.status === "success") {
const party = resp.data.party;
const address = party.addresses[0];
setFieldValue("driver_last_name", party.lastName);
setFieldValue("driver_given_name", party.firstName);
setFieldValue("driver_dob", moment(party.birthDate));
setFieldValue(
"driver_dob",
moment(party.birthDate).tz("America/Vancouver").toDate()
);
setFieldValue("driver_address", address.addressLine1);
setFieldValue("driver_city", address.city);
setFieldValue("driver_postal", address.postalCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ export const validationSchema = Yup.object().shape(
// Return true if the field is empty
return true;
}

console.log(dob);
const currentDate = moment();
const inputDate = moment(dob).utcOffset("+07:00");

const inputDate = moment(dob);
console.log(currentDate, inputDate);
const currentYear = currentDate.year();
const inputYear = inputDate.year();

Expand Down

0 comments on commit ec33a23

Please sign in to comment.