TemporalDate from DateTime - Flutter

Viewed 65

I am using AWS amplify for my project and trying to save the selected date from datepicker to the model.

DatePicker is giving the date in DateTime object, when i try to convert it to TemporalDate its giving me a day before date. i.e if i select todays date and assigning it to the TemporalDate then i am getting yesterday's date.

Here is my code :

var d1 = TemporalDate(pickedDate);
var d4 = TemporalDate(pickedDate.toUtc());
var d2 = TemporalDate(pickedDate.toLocal());
var d3 = TemporalDate(pickedDate).getDateTime();

pickedDate is holding today's date but the d1,d2,d3,d4 all is having yesterday's date.

Expected result is to get the today's date in the TemporalDate variable.

0 Answers
Related