Jump to:

21288 Posts in 5733 Topics by 2602 members

General Questions

SilverStripe Forums » General Questions » DateTimeField, Invalid time format

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 3631 Views
  • Mo
    Avatar
    Community Member
    465 Posts

    Re: DateTimeField, Invalid time format Link to this post

    Could you add a "TimeZone" dropdown next to the field. By default it would be filled in with one (say, us/uk etc), but then it could be changed?

    Alternatively, you could maybe have a static in the DatetimeField class, something like:

    DatetimeField::$timezone = "dd/mm/yyyy";

    Just some thoughts?

    Mo

  • Ingo
    Avatar
    Forum Moderator
    787 Posts

    Re: DateTimeField, Invalid time format Link to this post

    Timezone support would be great, although we'd have to investigate how its storage works across databases.
    Tom has done some timezone extensions to the CMS, incl. a TZDateTimeField: http://open.silverstripe.org/browser/modules/timezoneawareness/trunk - its pre 2.4 stable, not sure how useful it still is.

    Do you guys still see this as part of the DateField codebase? I want to avoid ending up with a huge bloated class (think HasManyComplexTableField), any suggestions on how to apply this cleanly in terms of design patterns?

    Zend_Date already has good timezone conversion support, so making this a presentational setting (and storing the date without timezone) might be a lot simpler.

    By the way, I've added a patch to the datepicker ticket mentioned before - it works with jQuery UI now, wohoo Still looking for feedback and code review: http://open.silverstripe.org/ticket/5397

  • Antti
    Avatar
    Community Member
    6 Posts

    Re: DateTimeField, Invalid time format Link to this post

    Do you get this working if you empty browser cache completely?
    My calendar dosnt popup when i go to date field in cms. If i refresh browser then its ok, and after that it load ok.

    Same thing happens with Dataobjectmanager module. First load dosnt seem to load correctly like something were missing, but after refreshing all ok.

    My code looks like this.
    class MyPage extends Page {
       static $db = array (
    'MyPageName'    => 'Text',
          'From'         => 'Date',
          'To'         => 'Date'
    }

    public function getCMSFields() {
    $f = parent::getCMSFields();

          // add fields
          $datefieldFrom    = new DateField('From','From');
          $datefieldTo     = new DateField('To','To');
          $datefieldFrom->setConfig('showcalendar', true);
          $datefieldTo->setConfig('showcalendar', true);

          $f->addFieldToTab("Root.Content.Main", $datefieldFrom);
          $f->addFieldToTab("Root.Content.Main", $datefieldTo);

    return $f;
    }
    }

    I been banging my head against wall with this one pretty long....

  • Ingo
    Avatar
    Forum Moderator
    787 Posts

    Re: DateTimeField, Invalid time format Link to this post

    Which browser are you using? I've copypasted your code into a fresh branches/2.4 installation, and the calendar shows up fine when clicking into the field (both for ajax load and when the form appears directly on a subsequent browser refresh). I don't think browser cache should have anything to do with it, but I've disable cache completely during testing just to be sure.

  • Antti
    Avatar
    Community Member
    6 Posts

    Re: DateTimeField, Invalid time format Link to this post

    thx for response...
    Its not browser issue does same with all browers. IE, FF, Chrome.
    And funny thing in this is that this works fine on my local wamp server but not on my customers lamp server.

    I did some test without Datefield cause i noticed that dataobject manager module does behave similary. After first load it just dosnt show as it should be (clean mac like title bar with text displaying 0 to 0 of 0)... AND when i try to add new Dataobject it goes to URL in main browser window while popup should appear.

    BUT everything ok after refreshing admin site.
    Tryed this with clean installation with silverstripe 2.4.1 and dataobject_manager 414.

    This is realy weird stuff. Any idea everyone what could tie silverstripe, javascript and server together.

    3631 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.