angular-calendar
angular-calendar copied to clipboard
angular-calendar Event is missing the `start` property
Hello, I zak,
I try to use angular-calendar with my data from an API
this.events$ = this.Api.getSchedule()
.pipe(
map(({ data }: { data: any }) => {
return data.mydatas.map((user: Schedule) => {
return user.myShedule.map((myShedule: Schedule) => {
return {
title: user.username,
start: new Date(myshedule.begin),
color: colors.yellow,
allDay: true,
}});
});
})
);
I get an error angular-calendar Event is missing the start
property
Do you know what is the problem please ? thanks a lot
Minimal reproduction of the problem with instructions
Versions
-
@angular/core
: "^8.1.1" -
angular-calendar
: "0.27.13" - Browser name and version: chrome 89
Thanks so much for opening an issue! If you'd like me to give priority to answering your issue or would just like to support this project, then please consider sponsoring me
@jimix974 Can you please update the description with the full logs of your error ?
@billyjov I found where I get an error
this.events$ = this.restApi.getSchedule()
.pipe(
map(({ data }: { data: Schedule[] }) => {
return data.mydatas.map((user: Schedule) => {
return {
title: user.username,
start: new Date(
user.period.begin + getTimezoneOffsetString(this.viewDate)
),
color: colors.yellow,
allDay: true,
};
});
})
);
There is no error now, but my real problem is to map my datas
my json return something like this:
{
"username":"jean",
"period":[
{
"begin":"2021-02-07T15:57:30+0200",
"title":"mytitle"
},
{
"begin":"2021-02-09T15:57:30+0200",
"title":"mytitle"
},
],
}
{
"username":"james",
"period":[
{
"begin":"2021-02-08T15:57:30+0200",
"title":"mytitle"
},
{
"begin":"2021-02-09T15:57:30+0200",
"title":"mytitle"
},
],
}
I search how to map "begin" data to "start" property
Thanks
@billyjov I found where I get an error
this.events$ = this.restApi.getSchedule()
.pipe(
map(({ data }: { data: Schedule[] }) => {
return data.mydatas.map((user: Schedule) => {
return {
title: user.username,
start: new Date(
user.period.begin + getTimezoneOffsetString(this.viewDate)
),
color: colors.yellow,
allDay: true,
};
});
})
);
There is no error now, but my real problem is to map my datas
my json return something like this:
{
"username":"jean",
"period":[
{
"begin":"2021-02-07T15:57:30+0200",
"title":"mytitle"
},
{
"begin":"2021-02-09T15:57:30+0200",
"title":"mytitle"
},
],
}
{
"username":"james",
"period":[
{
"begin":"2021-02-08T15:57:30+0200",
"title":"mytitle"
},
{
"begin":"2021-02-09T15:57:30+0200",
"title":"mytitle"
},
],
}
I search how to map "begin" data to "start" property
Thanks
@billyjov I found where I get an error
this.events$ = this.restApi.getSchedule()
.pipe(
map(({ data }: { data: Schedule[] }) => {
return data.mydatas.map((user: Schedule) => {
return {
title: user.username,
start: new Date(
user.period.begin + getTimezoneOffsetString(this.viewDate)
),
color: colors.yellow,
allDay: true,
};
});
})
);
There is no error now, but my real problem is to map my datas
my json return something like this:
{
"username":"jean",
"period":[
{
"begin":"2021-02-07T15:57:30+0200",
"title":"mytitle"
},
{
"begin":"2021-02-09T15:57:30+0200",
"title":"mytitle"
},
],
}
{
"username":"james",
"period":[
{
"begin":"2021-02-08T15:57:30+0200",
"title":"mytitle"
},
{
"begin":"2021-02-09T15:57:30+0200",
"title":"mytitle"
},
],
}
I search how to map "begin" data to "start" property
Thanks
@jimix974 user.period
is an array ? So user.period.begin
will always return undefined
I think ? :thinking: