You can add a column to your importer directly through the UI of your Fuse account, or you can do so in code using the documentation below.

The DateTime column type validates that values are a specific DateTime format.

addColumn Function

The addColumn function accepts an object as an argument.

  • internal_key (String) - required: The internal key used to access a column’s value.
  • label (String) - required: The user-facing column label that is shown in the interface.
  • column_type (String) - required: Should be “datetime”.
  • required (String) - required: Whether or not the column is required.
  • pattern (String) - required: must be one of these patterns.
  • position (Optional): The position or order of the column.
  • unique (Optional): Whether values should be unique.
  • validations (Optional): An array of built-in data validations. See Built-in DateTime Validations.
  • transformations (Optional): An array of built-in data transformations. See Built-in DateTime Transformations.

Example Code

  const importer = new FuseImporter(organizationApiKey, importerId);

  const validations = [
    {
      validation_type: "before_date",
      message: "Must be before 01/01/2023"
      options: {
        before_date: "2023-01-01T00:00:00.000Z"
      }
    }
  ];

  const transformations = [
    {
      transformation_type: "autoformat",
    }
  ];

  importer.addColumn({
    internal_key: "datetime",
    label: "Date and Time",
    column_type: "datetime",
    pattern: "MM/dd/yyyy HH:mm:ss",
    required: true,
    position: 1,
    unique: true,
    validations: validations,
    transformations: transformations
  });

  importer.show();

Patterns

MM/dd/yyyy HH:mm
Example: 08/31/2023 12:30; 09/31/2005 12:30

MM/dd/yyyy HH:mm:ss
Example: 08/31/2023 12:30:45; 08/31/2005 12:30:45

MM/dd/yyyy HH:mm:ss.SSS
Example: 08/31/2023 12:30:45.500; 08/31/2005 12:30:45.500

MM/dd/yyyy h:mm a
Example: 08/31/2023 1:30 PM; 08/31/2023 1:30 PM

MM/dd/yyyy h:mm:ss a
Example: 08/31/2023 1:30:45 PM; 08/31/2005 1:30:45 PM

MMM dd HH:mm:ss yyyy
Example: Jan 15 00:34:59 1990; Feb 15 00:34:59 1990

dd MMM HH:mm:ss yyyy
Example: 15 Jan 00:34:59 1990; 15 Feb 00:34:59 1990

MM/dd/yyyy h:mm:ss.SSS a
Example: 08/31/2023 1:30:45.500 PM; 06/11/2030 1:30:45.500 PM

MMMM dd, yyyy HH:mm
Example: August 31, 2023 12:30; January 15, 2023 12:30

MMMM dd, yyyy HH:mm:ss
Example: August 31, 2023 12:30:45; January 15, 2023 12:30:45

MMMM dd, yyyy h:mm a
Example: August 31, 2023 1:30 PM; January 15, 2023 1:30 PM

MMMM dd, yyyy h:mm:ss a
Example: August 31, 2023 1:30:45 PM; January 15, 2023 1:30:45 PM

MMMM dd, yyyy h:mm:ss.SSS a
Example: August 31, 2023 1:30:45.500 PM; January 15, 2023 1:30:45.500 PM

MM-dd-yy HH:mm
Example: 01-15-90 10:10; 05-15-90 10:10

dd-MM-yyyy HH:mm
Example: 15-01-1990 10:10; 15-01-1990 10:10

dd/MM/yyyy HH:mm
Example: 15/01/1990 10:10; 12/11/1990 10:10

dd-MM-yyyy h:mm a
Example: 15-01-1990 10:10 AM; 15-01-1990 10:10 AM

dd/MM/yyyy h:mm a
Example: 12/11/1990 10:10 AM; 15/01/1990 10:10 AM

MM/dd/yy HH:mm
Example: 01/15/90 10:10; 05/15/90 10:10

MM/dd/yy HH:mm:ss
Example: 01/15/90 10:10:14; 05/15/90 10:10:14

MM/dd/yy h:mm:ss a
Example: 01/15/90 5:10:14 AM; 05/15/90 5:10:14 AM

yyyy/MM/dd HH:mm
Example: 1990/01/15 10:10; 2007/11/16 10:10

MM-dd-yyyy HH:mm
Example: 01-15-1990 10:10; 05-15-1990 10:10

yyyy-MM-dd HH:mm
Example: 1990-01-15 10:10; 2007-11-16 10:10

yyyy-MM-dd’T’HH:mm:ss.SSSZ
Example: 1990-01-15T00:34:55.020+09:30; 2007-11-16T00:34:55.020+09:30

yyyy-MM-dd’T’HH:mm:ss.SSS
Example: 1990-01-15T00:34:55.020; 2007-11-16T00:34:55.020

yyyy-MM-dd’T’HH:mmZ
Example: 1990-01-15T10:10+09:30; 2007-11-16T10:10+09:30

yyyy-MM-dd’T’HH:mm
Example: 1990-01-15T10:10; 2007-11-16T10:10

dd/MM/yyyy
Example: 25/04/2023; 15/11/2023

Built-in DateTime Validations

The options property of addColumn accepts an array of validations. Each validation has three properties:

  • validation_type: the name of the validation
  • message: the message showed to the end user if the validation fails
  • options: options for the specific validation type

The validations property accepts an array of objects that contains these possible values: validation_type, message and options. As the example below:

validations: [
  {
    validation_type: "before_date",
    message: "Must be before 01/01/2023"
    options: {
      before_date: "2023-01-01T00:00:00.000Z"
    }
  }
]

before_date

Specifies that the value must be before a certain date.

validations: [
  {
    validation_type: "before_date",
    message: "Must be before 01/01/2023"
    options: {
      before_date: "2023-01-01T00:00:00.000Z"
    }
  }
]

after_date

Specifies that the value must be after a certain date.

validations: [
  {
    validation_type: "after_date",
    message: "Must be after 01/01/2023",
    options: {
      after_date: "2023-01-01T00:00:00.000Z",
    },
  },
];

unique_case_sensitive

Specifies that the value must be unique using case-sensitive comparison.

validations: [
  {
    validation_type: "unique_case_sensitive",
    message: "Must be unique (case sensitive)",
  },
];

unique_case_insensitive

Specifies that the value must be unique using case-insensitive comparison.

validations: [
  {
    validation_type: "unique_case_insensitive",
    message: "Must be unique (case insensitive)",
  },
];

Built-in DateTime Transformations

The options property of addColumn accepts an array of transformations. For the datetime transformations, you can specify one property:

  • transformation_type: the name of the transformation

The transformations property accepts an array of objects that contains these possible values: transformation_type. As the example below:

transformations: [
  {
    transformation_type: "autoformat",
  },
];

autoformat

The autoformat transformation automatically transforms the date in the column to a standardized format specified by the pattern on the column.

transformations: [
  {
    transformation_type: "autoformat",
  },
];