fix: wrong date selected in CDT (#3627)

This commit is contained in:
Richard Shiue 2023-10-06 10:13:46 +08:00 committed by GitHub
parent b4051c7e9f
commit 537c9d0865
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -86,15 +86,15 @@ class DateCellCalendarBloc
: (start, state.startDay!);
emit(state.copyWith(startDay: null, endDay: null));
await _updateDateData(
date: newStart.toLocal().date,
endDate: newEnd.toLocal().date,
date: newStart.date,
endDate: newEnd.date,
);
} else if (end == null) {
emit(state.copyWith(startDay: start, endDay: null));
} else {
await _updateDateData(
date: start!.toLocal().date,
endDate: end.toLocal().date,
date: start!.date,
endDate: end.date,
);
}
},

View File

@ -13,7 +13,6 @@ import 'package:appflowy_popover/appflowy_popover.dart';
import 'package:dartz/dartz.dart' show Either;
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/theme_extension.dart';
import 'package:flowy_infra/time/prelude.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@ -282,7 +281,7 @@ class _DatePickerState extends State<DatePicker> {
state.isRange ? false : isSameDay(state.dateTime, day),
onDaySelected: (selectedDay, focusedDay) {
context.read<DateCellCalendarBloc>().add(
DateCellCalendarEvent.selectDay(selectedDay.toLocal().date),
DateCellCalendarEvent.selectDay(selectedDay),
);
},
onRangeSelected: (start, end, focusedDay) {