csv2influx icon indicating copy to clipboard operation
csv2influx copied to clipboard

Option to Parse any DateFormat using momentjs

Open nzidol opened this issue 6 years ago • 3 comments

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;
}

nzidol avatar Mar 26 '19 01:03 nzidol

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

amper43 avatar Mar 26 '19 16:03 amper43

No I would need to learn how to develop node modules....

On Wed, Mar 27, 2019 at 5:29 AM Evgeny Smyshlyaev [email protected] wrote:

Hi @nzidol https://github.com/nzidol! Do you need help with opening pull request?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CorpGlory/csv2influx/issues/52#issuecomment-476732234, or mute the thread https://github.com/notifications/unsubscribe-auth/AM_PHVNrY8xbpRfovB3d4WVs4NEHhx4vks5vakragaJpZM4cKXW9 .

nzidol avatar Mar 27 '19 05:03 nzidol

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

jonyrock avatar Mar 27 '19 10:03 jonyrock