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 Date column type validates that input is of a specific date 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 “date”.
  • 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 Date Validations.
  • transformations (Optional): An array of built-in data transformations. See Built-in Date Transformations.

Example Code

  const importer = new FuseImporter();

  importer.getSessionToken = ... // see https://fuse-docs.flatirons.com/getting-started/sessions

  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: "date",
    label: "Date",
    column_type: "date",
    pattern: "MM/dd/yyyy",
    required: true,
    position: 1,
    unique: true,
    validations: validations,
    transformations: transformations,
  });

  importer.show();

Patterns

MM/dd/yyyy
Example: 08/31/2023; 12/15/2023

yyyy-MM-dd
Example: 2023-08-31; 2023-12-15

dd/MM/yyyy
Example: 31/08/2023; 15/12/2023

MM-dd-yyyy
Example: 08-31-2023; 12-15-2023

yyyy/MM/dd
Example: 2023/08/31; 2023/12/15

dd-MMMM-yyyy
Example: 31-August-2023; 15-December-2023

MMMM dd, yyyy
Example: August 31, 2023; December 15, 2023

dd/MM/yy
Example: 31/08/23; 15/12/23

MMMM dd, yy
Example: August 31, 23; December 15, 23

yy/MM/dd
Example: 23/08/31; 23/12/15

EEEE MMMM yyyy
Example: Tuesday August 2023; Thursday December 2023

EEEE dd MMMM yyyy
Example: Tuesday 08 August 2023; Thursday 15 December 2023

MM-dd-yy
Example: 01-15-90; 12-31-99

M-dd-yy
Example: 1-15-90; 12-31-99

dd-MM-yy
Example: 15-01-90; 31-12-99

dd-MM-yyyy
Example: 15-01-1990; 15-12-2023

dd-M-yy
Example: 15-1-90; 15-12-23

MM/dd/yy
Example: 01/15/90; 12/31/99

M/dd/yy
Example: 1/15/90; 12/31/99

MM.dd.yy
Example: 01.15.90; 12.31.99

M.dd.yy
Example: 1.15.90; 12.31.99

MMM-dd-yy
Example: Jan-15-90; Dec-31-99

MMMM-dd-yy
Example: January-15-90; December-31-99

dd-MMM-yy
Example: 15-Jan-90; 31-Dec-99

yyyy-M-dd
Example: 1990-1-15; 2023-12-31

M-dd-yyyy
Example: 1-15-1990; 12-31-2023

M/dd/yyyy
Example: 1/15/1990; 12/31/2023

dd/M/yyyy
Example: 15/1/1990; 31/12/2023

yyyy/M/dd
Example: 1990/1/15; 2023/12/31

dd.MM.yyyy
Example: 15.01.1990; 31.12.2023

dd.M.yyyy
Example: 15.1.1990; 31.12.2023

yyyy.MM.dd
Example: 1990.01.15; 2023.12.31

yyyy.M.dd
Example: 1990.1.15; 2023.12.31

MMM. dd, yyyy
Example: Jan. 15, 1990; Dec. 31, 2023

dd MMM. yyyy
Example: 15 Jan. 1990; 31 Dec. 2023

dd. MMM. yyyy
Example: 15. Jan. 1990; 31. Dec. 2023

EEE, MMM dd, yyyy
Example: Mon, Jan 15, 1990; Fri, Dec 31, 2023

Built-in Date 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 Date Transformations

The options property of addColumn accepts an array of transformations. For the date 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",
  },
];