1970 problem again

Hello implementation of event calendar raise error for year 1970 but when I display Object data but $event->start_date has not value. Have you any idea where can be a problem?

  • Is it not about time to strip all datepicker stuff from various plugins and use one little plugin to do that work? Theming etc. all becomes easier. It is what we do for our sites. 

  • Hi Tom,

    Do you have a version of the event calendar with the datepicker stripped out?

    If so, could you send it to me?

  • Hi
    I had the 1970 problem.
    For solving it , it was enough to move the calendar plugin to the end.
    Everything looks to work ok
    Thank for the plugin
    jbroide

  • OK, Jan Kirsten's fix works fine for Event calendar, but then date fields inside Profile manager don't work any more, they now show like unix timestamps. So, I think the best way is the one suggested by Tom, but has anyone already done it ? I think Kevin should get in contact with Jeroen Dalsem, the author of profile manager, in order to find a common solution, as both pluggins are key features for many people using Elgg. For the moment, I desactivated Event calendar to keep Profile manager working.

  • @Cash
    For me it works when I put the Event Calendar before the Profile plugin and not below.

    This is my plugins order : 1st: Event Calendar - 2nd: Profile - 3rd: Profile Manager

    So I can use and edit with no problem the date fields inside Profile manager. I still cannot edit the Event Calendar's date fields and also I have to use Kirsten's fix for the 1970 problem.

    So, now, I can use both, the only problem is to edit Event Calendar's dates. That's not a major problem and I hope Kevin could fix it in next release.

  • @capitaine - it is only working for you because you modified the code. For those who want to use the plugins as is, they need to put the event calendar below the profile manager (and have the limitation of not using date fields in profiles).

  • @Jan: gute Arbeit :)

    @Kevin: many thx for the plugin :)

     

    short update on the profile_manager vs. event_calendar datepicker problem

    I could not find an easy fast solution to make the form display fully compatible with both, with and without profile_manager - the patch will work 100% with profile_manager, without profile_manager the display of the old dates when you edit an event will be broken but it will still work

    * place event_calendar above profile_manager in your tool admin!

    * in mod/event_calendar/models/model.php replace

                  $event->start_date = strtotime($ed->start_date);
                  if ($ed->end_date) {
                          $event->end_date = strtotime($ed->end_date);
                  } else {
                          $event->end_date = $ed->end_date;
                  }

    with

      if (preg_match('/^[0-9]{1,}$/', $ed->start_date)) {
        $event->start_date = $ed->start_date;
      } else {
        $event->start_date = strtotime($ed->start_date);
      }
    //              $event->start_date = strtotime($ed->start_date);
      if ($ed->end_date) {
        if (preg_match('/^[0-9]{1,}$/', $ed->end_date)) {
            $event->end_date = $ed->end_date;
            if ($ed->end_date<100000)  $event->end_date = 0;
        } else {
            $event->end_date = strtotime($ed->end_date);
        }
      } else {
        $event->end_date = $ed->end_date;
      }
    //              if ($ed->end_date) {
    //                      $event->end_date = strtotime($ed->end_date);
    //              } else {
    //                      $event->end_date = $ed->end_date;
    //              }

    * in mod/event_calendar/views/default/event_calendar/forms/manage_event_content.php replace

          if ($event->form_data) {
                    // this is a form redisplay, so take the values as submitted
                    $start_date = $event->start_date;
                    $end_date = $event->end_date;
          } else {
                    // the values are from the database,
                    // so convert
                    $start_date = date("l, F j, Y",$event->start_date);
                    if ($event->end_date)
                    {
                            $end_date = date("l, F j, Y",$event->end_date);
                    } else {
                            $end_date = '';
                    }
            }

    with

    //      if ($event->form_data) {
                    // this is a form redisplay, so take the values as submitted
                    $start_date = $event->start_date;
                    $end_date = $event->end_date;
    /*      } else {
                    // the values are from the database,
                    // so convert
                    $start_date = date("l, F j, Y",$event->start_date);
                    if ($event->end_date)
                    {
                            $end_date = date("l, F j, Y",$event->end_date);
                    } else {
                            $end_date = '';
                    }
            } */

    that's all, for me it seems to work fine, have fun :)

     

  • I'm trying to localize for Hebrew, added the correct ui-datepicker.js as described here and also tried all the suggestions from this page for fixing the 1970 problem, - but nothing seems to work.

  • Same problem here ... It would be so good to get a new release to sort and clear all the previous posts.

  • This is not about the event calendar. You are running another plugin that conflicts with the event calendar. There is not much I can do about that until Elgg core includes the date picker and all plugins using one remove it from their code.

    Sorry.