addColumn Function
TheaddColumn
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
Patterns
MM/dd/yyyy HH:mmExample: 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 ofaddColumn
accepts an array of validations. Each validation has three properties:
validation_type:
the name of the validationmessage:
the message showed to the end user if the validation failsoptions:
options for the specific validation type
validation_type
, message
and options
. As the example below:
before_date
Specifies that the value must be before a certain date.after_date
Specifies that the value must be after a certain date.unique_case_sensitive
Specifies that the value must be unique using case-sensitive comparison.unique_case_insensitive
Specifies that the value must be unique using case-insensitive comparison.Built-in DateTime Transformations
The options property ofaddColumn
accepts an array of transformations. For the datetime transformations, you can specify one property:
transformation_type:
the name of the transformation
transformation_type
. As the example below:
autoformat
The autoformat transformation automatically transforms the date in the column to a standardized format specified by thepattern
on the column.