search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

NG7 - scheduler (zoom example): undefined "args" in .config ?!

Related article: Angular Scheduler: Zoom
Asked by Alex
5 years ago.

I'm trying get the "zoom"-example for angular 7 up and running.

I had already the scheduler (as my NG-compnonent: "eos-scheduler") up and running fine (without the extra zoom stuff).
When I add the zoomlevel-configs to the config-property, like described in:
https://code.daypilot.org/12302/angular-scheduler-zoom

[code]
config: any = {

// ...

zoomLevels: [
{
name: "Year",
properties: {
scale: "Day",
cellWidth: 40,
timeHeaders: [{groupBy: "Year"}, {groupBy: "Month", format: "MMMM"}, {groupBy: "Day", format: "d"}],
startDate: function (args) { return args.date.firstDayOfYear(); }, //// <---- = line 203 !
days: function (args) { return args.date.daysInYear(); },
}
},
....
[/code]

I get the following error(s):

Any idea?
Thanks in advance!

JS CONSOLE Output

EosSchedulerComponent.html:3 ERROR TypeError: args.date.firstDayOfMonth is not a function
at Object.startDate [as val] (eos-scheduler.component.ts:203)
at daypilot-angular.min.js:24
at Array.forEach (<anonymous>)
at Object.zoom.Rh (daypilot-angular.min.js:24)
at Object.preInit (daypilot-angular.min.js:31)
at Object.Md [as loadOptions] (daypilot-angular.min.js:31)
at t.updateOptions (daypilot-angular.min.js:33)
at t.ngAfterViewInit (daypilot-angular.min.js:33)
at callProviderLifecycles (core.js:22318)
at callElementProvidersLifecycles (core.js:22292)

Answer posted by Dan Letecky [DayPilot]
5 years ago.

It looks like if you set startDate using a string (not DayPilot.Date) in the config you may receive it in args.date unconverted.

It's fixed now in the latest sandbox build (2019.2.3893).

In previous versions, you can convert it to DayPilot.Date manually as a workaround:

startDate: function (args) { return new DayPilot.Date(args.date).firstDayOfYear(); }, //// <---- = line 203 ! 

Please let me know if it didn't help.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.