Skip to content

Commit

Permalink
🔖 calculate week difference based on start day. (#74)
Browse files Browse the repository at this point in the history
Update package version

Update CHANGELOG.md

Co-authored-by: Parth Baraiya <[email protected]>
  • Loading branch information
PRBaraiya and ParthBaraiya authored Jun 2, 2022
1 parent 06dc0a1 commit 475fff9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
15 changes: 8 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# [0.0.5]() - 15 March 2022 [Unreleased]
# [0.0.5 - 2 Jun 2022](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.5)

- Fixed issue [#48 - WeekView header date is different from the calendar view](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/48)
- Fixed issue [#46 - Change beginning of week in MonthView](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/46)
- Added feature [#46 - Change beginning of week in MonthView](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/46)
- Fixed issue [#42 - WeekDayTile causes RenderFlex-Overflow](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/42)
- Fixed issue [#65 - Adding onCellTap callback breaks whole calendar](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/65)
- Fixed issue [#62 - Missing redraw events](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/62)
- Show live time indicator line above event tiles. PR [#67](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/pull/67)

# [0.0.4](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.4)
# [0.0.4 - 2 Mar 2022](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.4)

- Fixed issue [#39 - Detect a long press on the calendar](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/39)
- Fixed issue [#38 - Modifying CalendarEventData](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/38)
- Fixed issue [#27 - EventController remove event don't work](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/27)
- Fixed issue [#13 - Give the option to show weekdays in a weekview.](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/13)
- Fixed issue [#13 - Give the option to show weekdays in a WeekView.](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/13)

# [0.0.3](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.3)
# [0.0.3 - 12 Oct 2021](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.3)

- Added support for multiple day events

# [0.0.2](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.2)
# [0.0.2 - 3 Sep 2021](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.2)

- Update `README.md` file.
- Add license information in package files.
Expand All @@ -28,6 +29,6 @@
- Add `onCellTap` callback in `MonthView`.
- Make `controller` optional parameter in all views where `CalendarControllerProvider` is provided.

# [0.0.1](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.1)
# [0.0.1 - 26 Aug 2021](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.1)

- Initial release
8 changes: 6 additions & 2 deletions lib/src/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ extension DateTimeExtensions on DateTime {
int getDayDifference(DateTime date) => difference(date).inDays.abs();

/// Gets difference of weeks between [date] and calling object.
int getWeekDifference(DateTime date) =>
(firstDayOfWeek().difference(date.firstDayOfWeek()).inDays.abs() / 7)
int getWeekDifference(DateTime date, {WeekDays start = WeekDays.monday}) =>
(firstDayOfWeek(start: start)
.difference(date.firstDayOfWeek(start: start))
.inDays
.abs() /
7)
.ceil();

/// Returns The List of date of Current Week
Expand Down
3 changes: 2 additions & 1 deletion lib/src/week_view/week_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,8 @@ class WeekViewState<T extends Object?> extends State<WeekView<T>> {

_currentStartDate = _currentWeek.firstDayOfWeek(start: widget.startDay);
_currentEndDate = _currentWeek.lastDayOfWeek(start: widget.startDay);
_currentIndex = _minDate.getWeekDifference(_currentEndDate);
_currentIndex =
_minDate.getWeekDifference(_currentEndDate, start: widget.startDay);
}

/// Sets the minimum and maximum dates for current view.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: calendar_view
description: A Flutter package allows you to easily implement all calendar UI and calendar event functionality.
version: 0.0.4
version: 0.0.5
homepage: https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view
issue_tracker: https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues

Expand Down

0 comments on commit 475fff9

Please sign in to comment.