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

Date Format #79

Open
emetcalf-leadventure opened this issue Jun 17, 2024 · 0 comments
Open

Date Format #79

emetcalf-leadventure opened this issue Jun 17, 2024 · 0 comments

Comments

@emetcalf-leadventure
Copy link

Expected Behavior

https://www.verygoodsecurity.com/docs/api/collect/#api-formfield
I would like to be able to change the format of the date that is redacted so that when I send it to a 3rd party I can reveal it in the format they are expecting. I would expect to set this in the serializer option.

Current Behavior

The date is always redacted and reveal in the "yyyy-mm-dd" format.

Possible Solution

To workaround I need to create custom Larky code in my outbound route:

def process(input, ctx):
    body = json.loads(str(input.body))

    applicantDob = vault.reveal(body['primaryApplicant']['dateOfBirth'])
    body['primaryApplicant']['dateOfBirth'] = reformatDate(applicantDob)

    input.body = builtins.bytes(json.dumps(body))
    return input

def reformatDate(date):
    return '/'.join((date[5:7], date[8:], date[:4]))

Steps to Reproduce (for bugs)

form.field('#space-for-my-field', {
  type: 'date',
  name: 'date-of-birth',
  validations: ['required'],
});

Context

I have 3rd party clients whose API only accepts date of birth in the format of 'mm/dd/yyyy'.

Your Environment

  • Version used: 2.18.6
  • Browser Name and version: All
  • Operating System and version (desktop or mobile): All
  • Link to your project: N/A
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

No branches or pull requests

1 participant