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

Title is computed incorrectly for work week (no weekends) #2884

Closed
gas12n opened this issue Oct 1, 2015 · 5 comments
Closed

Title is computed incorrectly for work week (no weekends) #2884

gas12n opened this issue Oct 1, 2015 · 5 comments
Labels
Confirmed Toolbar View Date Range Customization about which dates/times are displayed
Milestone

Comments

@gas12n
Copy link

gas12n commented Oct 1, 2015

I have a custom view that is defined as:

agendaNoWeekend: 
{
  type: "agendaWeek",
  buttonText: "Work week",
  weekends: false
}

The function computeTitle uses intervalStart and intervalEnd which include weekends. My undestanding is that start and end have hidden days skipped. By using start and end the title will reflect the period of time the calendar is actually showing (e.g. in this case it won't show the weekend).

A byproduct of using start and end is that in month view for October it would show something like September - November because that's the actual period the calendar is showing (last few days of September and first few of October).

This change seems to work for me:

computeTitle: function () {

            var startDate, endDate;

            if (this.intervalUnit == 'month') {
                startDate = this.intervalStart;
                endDate = this.intervalEnd;
            }

            else {
                startDate = this.start;
                endDate = this.end;
            }

            return this.formatRange(
            { start: startDate, end: endDate },
                this.opt('titleFormat') || this.computeTitleFormat(),
                this.opt('titleRangeSeparator')
            );
        }

Cheers

@arshaw
Copy link
Member

arshaw commented Oct 11, 2015

hi @gas12n thanks for the report, but would you be able to post a demoable recreation as well? http://fullcalendar.io/wiki/Reporting-Bugs/

would really help. thanks

@arshaw arshaw closed this as completed Oct 11, 2015
@gas12n
Copy link
Author

gas12n commented Oct 12, 2015

Here is the demo: http://jsbin.com/bukuqupico/edit?js,output

Switch between week and work week view. Notice how the title in the center does not change even though the range shown has.

@arshaw
Copy link
Member

arshaw commented Oct 13, 2015

ahh i see. thanks

@arshaw arshaw reopened this Oct 13, 2015
@arshaw arshaw added View Date Range Customization about which dates/times are displayed Toolbar labels Jun 12, 2016
alexthehurst pushed a commit to illuminateeducation/fullcalendar that referenced this issue Jan 9, 2017
Ticket: ETC-768
Purpose of Change: Correct a flaw in FullCalendar to correctly show the
dates in the title of the calendar, even when weekends are hidden
Description of Change: Logic is based on the suggestion by gas12n in
this GitHub issue:
fullcalendar#2884
@JsGuru30
Copy link

JsGuru30 commented Jan 11, 2017

Sorry to bother but has this issue been resolved yet? I am experiencing same problem and would like to know how to fix it.
Thanks.

@arshaw arshaw added Confirmed and removed Accepted labels Jan 17, 2017
@arshaw arshaw added this to the 3.1.1 milestone Feb 12, 2017
@arshaw arshaw added the Merged label Feb 12, 2017
@arshaw
Copy link
Member

arshaw commented Feb 14, 2017

Fixed in v3.2.0

@arshaw arshaw closed this as completed Feb 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Confirmed Toolbar View Date Range Customization about which dates/times are displayed
Projects
None yet
Development

No branches or pull requests

3 participants