Skip to content

Feature request: add a way to pass js Date objects to a column #4807

@lpcvoid

Description

@lpcvoid

Is your feature request related to a problem? Please describe.
I would like to pass data to Tabulator which contains js Date objects. This currently, as far as I can tell, doesn't work. What Tabulator would need is a way to pass the Date object to moment/luxon's fromJSDate() function. A similar mechanism exists already for ISO date format strings, if inputFormat in a Tabulator column definition is set to "iso", Tabulator will pass the string to moment/luxon's fromISO() function.

Describe the solution you'd like
I'd like a new inputFormat string ("jsdate" maybe?) which signals Tabulator that the passed column data are js Date objects, and which enables all the goodies that the datetime column formatter enables, like inline editing.

As an example column definition:

			formatter: 'datetime',
			formatterParams: {
				inputFormat: 'jsdate',
				outputFormat: 'dd/MM/yy',
				invalidPlaceholder: '(invalid date)'
			},

Describe alternatives you've considered
I tried creating a custom formatter for that column, but this then makes inline editing more complicated.

Additional context
Not sure if there's any additional context I can provide. Please ask if you have questions :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Suggested FeatureA suggested feature that is waiting review

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions