Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request - Start Date and End Date interval #5

Open
jhonattanS opened this issue Jul 19, 2020 · 1 comment
Open

Feature Request - Start Date and End Date interval #5

jhonattanS opened this issue Jul 19, 2020 · 1 comment

Comments

@jhonattanS
Copy link

Hi, first of all, thanks for the package!

I was wondering if it's possible to implement a 'Start date' and 'End Date' Interval for the construction of the heatmap.
I want to be able to show the user the heat map only between the selected data range.

Thanks

@s-j-a
Copy link

s-j-a commented Oct 13, 2020

I was looking for something similar, I wanted the heat map to go forward starting a few weeks before today and show future events. I know it's not recommended to edit plugin code as it gets overwritten when there are updates, but it solved my need.

I changed the the function getCalendarDates as follows in file week_columns.dart

original function

  List<DateTime> getCalendarDates(int columnsAmount) {
    
    DateTime firstDayOfTheWeek = TimeUtils.firstDayOfTheWeek(date);
    DateTime firstDayOfCalendar = TimeUtils.firstDayOfCalendar(firstDayOfTheWeek, columnsAmount);
    return TimeUtils.datesBetween(firstDayOfCalendar, date);
  }

new function

  List<DateTime> getCalendarDates(int columnsAmount) {

    DateTime today = DateTime.now();
    DateTime firstDayOfTheWeek = TimeUtils.firstDayOfTheWeek(today).subtract(Duration(days:28) );
    DateTime firstDayOfCalendar = firstDayOfTheWeek; 
    DateTime lastDayofCalendar = today.add(Duration(days: (DateTime.daysPerWeek * (columnsAmount - 1))));
    return TimeUtils.datesBetween(firstDayOfCalendar,lastDayofCalendar);
  }

It would be great if this or something similar can be added to the plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants