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

Dates not being transform proper #81

Closed
gitricko opened this issue May 7, 2020 · 1 comment
Closed

Dates not being transform proper #81

gitricko opened this issue May 7, 2020 · 1 comment

Comments

@gitricko
Copy link

gitricko commented May 7, 2020

eg:

  var src1 = { 
      'txn': [{"datamov": "07/01/2020"},{"datamov": "07/01/2020"}]
  }
  var map1 = {
    "txn[].datamov": {
      key: "txn[].dat",
      transform: val => moment(val, 'DD/MM/YYYY').format('YYYY-MM-DD')
    }
  };
  var expect = { 
      'txn': [{"datamov": "2020-07-01"},{"datamov": "2020-07-01"}]
  }
  var result = om(src1, map1);

but what i got was:
{ txn: [ { dat: 'Invalid date' }, { dat: 'Invalid date' } ] }

Could not figure out what was wrong

@gitricko
Copy link
Author

gitricko commented May 7, 2020

Closing this but will watch #77

@gitricko gitricko closed this as completed May 7, 2020
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