Thats why I am confused. There is no native Timest...
# flutter
m
Thats why I am confused. There is no native Timestamp method in dart. It came bundled with Firebase.
v
m
Wouldnt that create issues later on when I need to filter according to date or order by date if my date is in the form of a string?
v
no the string should be converted to your column type. In this case
timestamp
m
You mean Supabase would do that automatically if I give it a
Datetime.now().toIso8601String()
?
v
I think so
d
I'm not near my computer but I'm pretty sure I just use DateTime
m
I'll try it out in a bit and get back here whether it works or not
Type of date column in Supabase :
date
-> Calendar date(year, month, date)=> Try #1:
DateTime.now().millisecondsSinceEpoch
on Flutter's end. This did not
insert
the row into the table as this column field did not fit the schema. Try #2:
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day,),
on Flutter's end. My assumption was that Flutter's object
DateTime
technically contains time as well while supabase's
date
does not. May that is the reason both do not match. But during this try, I noticed that Flutter still added zeros for time even if I didnt specify the time. Try #3 & #4:
DateFormat('yyyy,mm,dd').format(DateTime.now())
and
DateTime.now().toIso8601String()
on Flutter's end. Both return a
String
instead of an instance of
Datetime
. Upon inserting this, Supabase for some reason automatically converts the string to a date. Therefore, I think this is the solution. If anybody knows, please correct me but I think that there is no DIRECT equivalent of Supabase's
date
in Flutter/Dart. For now, this
String
to
date
method works.
If you use just
DateTime
then you must be using a
TimeStamp
in Supabase. Thats the only way they match.
3 Views