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

angular-calendar Event is missing the start property #1452

Open
jimix974 opened this issue Apr 30, 2021 · 6 comments
Open

angular-calendar Event is missing the start property #1452

jimix974 opened this issue Apr 30, 2021 · 6 comments
Labels

Comments

@jimix974
Copy link

jimix974 commented Apr 30, 2021

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
@matts-bot
Copy link

matts-bot bot commented Apr 30, 2021

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

@billyjov
Copy link
Collaborator

billyjov commented May 1, 2021

@jimix974 Can you please update the description with the full logs of your error ?

@jimix974
Copy link
Author

jimix974 commented May 2, 2021

@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 jimix974 closed this as completed May 2, 2021
@no-response no-response bot removed the needs reply label May 2, 2021
@jimix974
Copy link
Author

jimix974 commented May 2, 2021

@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 jimix974 reopened this May 2, 2021
@jimix974
Copy link
Author

jimix974 commented May 2, 2021

@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

@GentileFulvio
Copy link

@jimix974 user.period is an array ? So user.period.begin will always return undefined I think ? 🤔

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

No branches or pull requests

3 participants