add birthday events into jQuery full calendar each year

前端 未结 1 906
情深已故
情深已故 2021-01-23 13:57

I\'m trying to insert into jQuery full calendar event data, which in this case represents birthdays of users. I\'m retrieving birthdays from MySQL data

1条回答
  •  后悔当初
    2021-01-23 14:21

    Well the easiest solutions may be to alter your PHP loop and add "multiple" years to your events.

    while ($birthday_row = $birthday_r->fetch_row()){
        $yearBegin = date("Y");
        $yearEnd = $yearBegin + 10; // edit for your needs
        $years = range($yearBegin, $yearEnd, 1);
    
        foreach($years as $year){
            $birthday_array[] = array(
                'title' => $birthday_row[0],
                'start' => $year . "-" . $birthday_row[1] . "-" . $birthday_row[2]
            );
        }
    }
    

    Two drawbacks :

    • you can't manage different birthdays (so a person's birthdate may occur, even after his dead)
    • it leeds into exponential costs

    You may also take a look at the demo with repeating events to build a frontend solution.

    0 讨论(0)
提交回复
热议问题