mirror of
https://github.com/Iconica-Development/flutter_date_time_picker.git
synced 2025-05-18 18:33:49 +02:00
Merge pull request #20 from Iconica-Development/hotfix/skipping-month-bug
fixed skipping month bug
This commit is contained in:
commit
a341fb5274
6 changed files with 15 additions and 26 deletions
|
@ -1,3 +1,7 @@
|
|||
## 2.2.3
|
||||
|
||||
- Fixed skipping month bug
|
||||
|
||||
## 2.2.2
|
||||
|
||||
- Made the popup dismissible
|
||||
|
|
|
@ -3,8 +3,4 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
/// Defines the shape of a specific date.
|
||||
enum DateBoxShape {
|
||||
circle,
|
||||
rectangle,
|
||||
roundedRectangle
|
||||
}
|
||||
enum DateBoxShape { circle, rectangle, roundedRectangle }
|
||||
|
|
|
@ -31,7 +31,6 @@ extension DateTimeExtension on DateTime {
|
|||
bool get isLeapYear =>
|
||||
(year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0);
|
||||
|
||||
|
||||
/// Returns the amount of days in the current month of the [DateTime] object
|
||||
int daysInMonth() {
|
||||
return DateTime(year, month + 1, 0).day;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_date_time_picker/src/extensions/date_time.dart';
|
||||
import 'package:flutter_date_time_picker/src/models/date_time_picker_theme.dart';
|
||||
import 'package:flutter_date_time_picker/src/utils/date_time_picker_controller.dart';
|
||||
import 'package:flutter_date_time_picker/src/models/date_constraint.dart';
|
||||
|
@ -232,14 +231,10 @@ class _OverlayDateTimePickerState extends State<OverlayDateTimePicker> {
|
|||
void nextDate() {
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_dateTimePickerController.browsingDate =
|
||||
_dateTimePickerController.browsingDate.add(
|
||||
Duration(
|
||||
days: DateTime(
|
||||
_dateTimePickerController.browsingDate.year,
|
||||
_dateTimePickerController.browsingDate.month,
|
||||
).daysInMonth(),
|
||||
),
|
||||
_dateTimePickerController.browsingDate = DateTime(
|
||||
_dateTimePickerController.browsingDate.year,
|
||||
_dateTimePickerController.browsingDate.month + 1,
|
||||
_dateTimePickerController.browsingDate.day,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -247,14 +242,10 @@ class _OverlayDateTimePickerState extends State<OverlayDateTimePicker> {
|
|||
void previousDate() {
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_dateTimePickerController.browsingDate =
|
||||
_dateTimePickerController.browsingDate.subtract(
|
||||
Duration(
|
||||
days: DateTime(
|
||||
_dateTimePickerController.browsingDate.year,
|
||||
_dateTimePickerController.browsingDate.month,
|
||||
).daysInMonth(),
|
||||
),
|
||||
_dateTimePickerController.browsingDate = DateTime(
|
||||
_dateTimePickerController.browsingDate.year,
|
||||
_dateTimePickerController.browsingDate.month - 1,
|
||||
_dateTimePickerController.browsingDate.day,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -21,8 +21,7 @@ class WeekDateTimePickerSheet extends StatelessWidget {
|
|||
final double weekDateBoxSize;
|
||||
|
||||
String _getDateHeader(BuildContext context) {
|
||||
var weekDays =
|
||||
dateTimePickerController.browsingDate.daysOfWeek();
|
||||
var weekDays = dateTimePickerController.browsingDate.daysOfWeek();
|
||||
|
||||
var firstDay = weekDays.first.day.toString();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_date_time_picker
|
||||
description: A Flutter package for date and time picker.
|
||||
version: 2.2.2
|
||||
version: 2.2.3
|
||||
homepage: https://iconica.nl/
|
||||
|
||||
environment:
|
||||
|
|
Loading…
Reference in a new issue