Skip to content

Option to Parse any DateFormat using momentjs #52

@nzidol

Description

@nzidol

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions