Ivandt logo

Date and time transformers

Transformers for date and time manipulation

formatDates

Formats dates according to specified patterns. Uses Moment.js for parsing and formatting. Accepts Date objects, numbers, booleans, and null as-is. For strings, parses using specified patterns and outputs in the desired format.

Payload:

PropertyTypeRequiredDefaultDescription
formatPatternstringYes-Moment.js format string for output
parsePatternsstring[]No[formatPattern, ISO_8601]Array of Moment.js format patterns to try when parsing input dates
strictParsingbooleanNotrueWhether to use strict parsing mode. When false, also accepts ISO 8601 format
localestring[]No-Optional locale for date formatting
{
  key: 'birth_date',
  label: 'Birth date',
  type: 'date',
  transformers: [
    {
      action: 'formatDates',
      payload: {
        parsePatterns: ['MM/DD/YYYY', 'DD-MM-YYYY', 'YYYY-MM-DD'],
        formatPattern: 'YYYY-MM-DD',
        strictParsing: true
      }
    }
  ]
}

Examples:

  • Input: "12/31/2024" with parsePatterns: ['MM/DD/YYYY']

  • Output: "2024-12-31"

  • Input: "31-12-2024" with parsePatterns: ['DD-MM-YYYY']

  • Output: "2024-12-31"

Common format patterns:

  • YYYY-MM-DD - ISO format (2024-12-31)
  • MM/DD/YYYY - US format (12/31/2024)
  • DD/MM/YYYY - European format (31/12/2024)
  • MMMM D, YYYY - Long format (December 31, 2024)
  • MMM D, YYYY - Short format (Dec 31, 2024)

See Moment.js format documentation for all available patterns.


fillWithTimestamp

Fills empty cells with a timestamp. Only affects cells that are null, undefined, or empty strings. Existing values are preserved.

Payload:

PropertyTypeRequiredDefaultDescription
timestampDateNoCurrent date/timeThe timestamp to fill empty cells with
{
  key: 'created_at',
  label: 'Created at',
  type: 'date',
  transformers: [
    {
      action: 'fillWithTimestamp',
      payload: {
        timestamp: new Date('2025-01-01')
      }
    }
  ]
}

Example:

  • Input: null
  • Output: "2025-01-01T00:00:00.000Z"

Without payload (uses current time):

{
  key: 'imported_at',
  label: 'Imported at',
  type: 'date',
  transformers: [
    {
      action: 'fillWithTimestamp'
    }
  ]
}