Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

4.0.0-1: context.cmdFormatter & start.format is not a function #172

Open
fullstackfool opened this issue Oct 25, 2018 · 10 comments
Open

4.0.0-1: context.cmdFormatter & start.format is not a function #172

fullstackfool opened this issue Oct 25, 2018 · 10 comments

Comments

@fullstackfool
Copy link

We've been using eventSources like:

{
          events({start, end, timeZone}, callback) {
            self.$http.get(`/holidays`, {
                timezone: timezone,
                start: start.format('YYYY/MM/DD')
            }).then(response => {
              callback(response.data.data)
            })
          },
          color: 'yellow',
          textColor: 'black',
},

Recently receiving errors of start.format is not a function.

Logging start shows it to be an object:

{
    end: Sun Nov 11 2018 00:00:00 GMT+0000 (Greenwich Mean Time) {}
    endStr: "2018-11-11T00:00:00Z"
    start: Sun Sep 30 2018 00:00:00 GMT+0100 (British Summer Time) {}
    startStr: "2018-09-30T00:00:00+01:00"
    timeZone: "local"
}

end:

f ( ) {
        if (!isResolved) {
            isResolved = true;
            success.apply(this, arguments);
        }
}

If i fix the format issue by updating to:

{
          events({start, end, timeZone}, callback) {
            self.$http.get(`/holidays`, {
                start: moment(start).format('YYYY/MM/DD'), 
                timezone: timezone
            }).then(response => {
              callback(response.data.data)
            })
          },
          color: 'yellow',
          textColor: 'black',
},

Then we get a new error: TypeError: context.cmdFormatter is not a function

Versions:
vue-full-calendar: 4.0.0-1
fullcalendar: 4.0.0-alpha.2
moment: 2.22.2
moment-timezone: 0.5.21

I suspect we've changed another dependacy, which in turn has effected fullcalendar, but i can't figure out what. Does this error look familiar to anyone?

@BrockReece
Copy link
Collaborator

What happens if you log out moment(start), are you getting a valid moment obj?

@fullstackfool
Copy link
Author

fullstackfool commented Oct 25, 2018

Invalid object.

Tracked the issue to when vue-full-calendar is using fullcalendar: 4.0.0-alpha.2. Forcing it to use 4.0.0-alpha fixes the issue.

@ash-rain
Copy link

+1 Subscribing. Having the same issue with the new alpha.

@BrockReece
Copy link
Collaborator

I am guessing then this is probably an error with fullcalendar: 4.0.0-alpha.2 rather than this repo. Is it worth opening an issue on their repo?

I am happy to fix the version of fullcalendar though to the more stable version if this is a blocker?

@BrockReece
Copy link
Collaborator

I am reading their release notes for v4, it looks like there is a section outlining some changes in 'Event Source Function'

Have you read the docs?
Seems like the fetchInfo obj has some additional fields for startStr and endStr. Are they worth trying?

@JackPriceBurns
Copy link

It seems the first argument is this fetchInfo object that has both the start and the end date time stamps. The start and end are no longer passed separately? And the other arguments seem to return promises, not sure what they do.

@fullstackfool
Copy link
Author

fullstackfool commented Oct 25, 2018

Quite possibly - looking into it now.

The fixed version would be a good temporary fix, thanks!

Edit: Also, if the package is going to use the alpha version of fullcalendar, shouldn't the local v4.0.0-1 release also be marked as Pre-release?

@fullstackfool
Copy link
Author

Yeah, so the events have been combined, which you can then use to instantiate a moment object.

Then we get a new error: TypeError: context.cmdFormatter is not a function

Now going to try using an event url, instead of the function

@identy
Copy link

identy commented Mar 24, 2019

// titleFormat: 'MMMM'

error in title format

@Xalior
Copy link

Xalior commented Apr 9, 2019

This bug still exists in the final release of fullcal, and is in the base library itself outwith of the vue integrations it seems (I can reproduce it on the base library, exact same issues as @fullstackfool reports above)

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

No branches or pull requests

6 participants