Skip to content

date columns should be provided as DateTime instead of String. #845

Open
@mateusfccp

Description

@mateusfccp

Is your feature request related to a problem? Please describe.
Currently, if I have a table with a column of type date, when I query for the data, the runtime type of the data is String.

For instance, for a date value of 2024-02-25, I receive the string "2024-25-02".

Describe the solution you'd like
Instead, we should receive DateTime.

For instance, for a date value of 2024-02-25, I should receive the object DateTime(2024, 02, 25).

Describe alternatives you've considered
The alternative is to do nothing and let the consumer parse the date. This is how we have to do currently.

void main() async {
	final data = await supabase.from('members').select('birthday');
	for (final datum in data) {
		final birthday = DateTime.parse(datum['birthday']); // Manually parsing the received string
		// Do something with `birthday`...
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedThis issue is blocked by another issueenhancementNew feature or requestpostgrestThis issue or pull request is related to postgrest

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions