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

Option to Parse any DateFormat using momentjs #52

Open
nzidol opened this issue Mar 26, 2019 · 3 comments
Open

Option to Parse any DateFormat using momentjs #52

nzidol opened this issue Mar 26, 2019 · 3 comments

Comments

@nzidol
Copy link

nzidol commented Mar 26, 2019

Not sure how to create a pull request for this; but this works for me to parse a "MM/DD/YYYY" date.

const moment = require('moment');

function parseValue(recordValue, mappingObject) {
  if(mappingObject.format === 'jsDate') {
    // convert millisconds to nanoseconds
    return (new Date(recordValue).getTime()) * 1000 * 1000;
  }
  if(mappingObject.format != '') {
	return (moment(recordValue,mappingObject.format)) * 1000 * 1000;
  }
  return recordValue;
}
@amper43
Copy link

amper43 commented Mar 26, 2019

Hi @nzidol!
Do you need help with opening pull request?

@nzidol
Copy link
Author

nzidol commented Mar 27, 2019 via email

@jonyrock
Copy link
Member

jonyrock commented Mar 27, 2019

@nzidol is it fun for learn it? Cuz if you just want to see it working, we can make a PR for you

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

3 participants