`date` columns should be provided as `DateTime` instead of `String`.

Open
#845 10 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
dart, flutter, postgres
Domain
databases

Research direction

No file or test is named in the issue. Start by reproducing the query against a table with a date column and inspect how the returned value is typed; done means the date is returned as a DateTime representing the stored year, month, and day rather than a String.

Written by the indexing model from the issue text.

Description

blocked enhancement planned postgrest

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`...
	}
}
Dominant language
Dart
Stars
1k
Forks
310
Avg merge
22h 15m
Merged PRs (30d)
97

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/supabase-flutter

All issues in supabase/supabase-flutter

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.