ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Datepicker issus both in CP and in Safecracker

August 29, 2012 9:03am

Subscribe [1]
  • #1 / Aug 29, 2012 9:03am

    Laisvunas

    879 posts

    This question may be related to a resolved thread.

    Hi,

    I encountered several issues with datepicker both in CP and in Safecracker.

    1) In CP entry date is being displayed with seconds (In config the value of the variable $config[‘include_seconds’] has the value ‘y’), but after picking of the date seconds are not displayed. So it seems like a bug: datepicker does not honor config variable. The same situation is in Safeckreacker: entry date displayed at first with seconds, but after picking of the date seconds disappear.

    2) In Safecracker entry date at first is being displayed containing hour numbers having leading zeroes, but after picking of the date hour numbers loose leading zeroes.

    3) Datepicker localization code such as this

    jQuery(function($){
              $.datepicker.regional['lt'] = {
                closeText: 'Uždaryti',
                prevText: '< Atgal',
                nextText: 'Pirmyn >',
                currentText: 'Šiandien',
                monthNames: ['Sausis','Vasaris','Kovas','Balandis','Gegužė','Birželis',
                'Liepa','Rugpjūtis','Rugsėjis','Spalis','Lapkritis','Gruodis'],
                monthNamesShort: ['Saus','Vas','Kov','Bal','Geg','Birž',
                'Liep','Rugpj','Rugs','Spal','Lapkr','Gruod'],
                dayNames: ['Sekmadienis','Pirmadienis','Antradienis','Trečiadienis','Ketvirtadienis','Penktadienis','Šeštadienis'],
                dayNamesShort: ['S','P','A','T','K','Pn','Š'],
                dayNamesMin: ['S','P','A','T','K','Pn','Š'],
                weekHeader: 'KW',
                dateFormat: 'yy-mm-dd',
                firstDay: 1,
                isRTL: false,
                showMonthAfterYear: true,
                yearSuffix: ''};
              $.datepicker.setDefaults($.datepicker.regional['lt']);
            });

    has even more unfortunate result: hours, minutes, and seconds are not displayed after picking of the date. What should be value of “dateFormat” in this code in order to display hours, minutes and seconds?

    The removal of “dateFormat” results into dates in which hour numbers are displayed without leading zeroes.

    I need to display dates consistently, that is, in CP and Safecracker,  in this format: 2012-08-29 03:01:09 PM

    How can I achieve this?

    Thanks.

     

  • #2 / Aug 30, 2012 12:52pm

    Kevin Smith

    4784 posts

    Hi Laisvunas,

    1) In CP entry date is being displayed with seconds (In config the value of the variable $config[‘include_seconds’] has the value ‘y’), but after picking of the date seconds are not displayed. So it seems like a bug: datepicker does not honor config variable. The same situation is in Safeckreacker: entry date displayed at first with seconds, but after picking of the date seconds disappear.

    Yep, I was able to reproduce this myself, so I went ahead and filed the bug report for you here.

    Your other two concerns are related, and I’ll need to take a bit to check into those. I can see that the dateFormat for the Lithuanian localization is set in the jQuery core, so I’ll have to dig a little deeper here. I’ll report back shortly.

  • #3 / Aug 30, 2012 3:20pm

    Kevin Smith

    4784 posts

    From what I can find, it doesn’t look like EE offers support for localizing the datepicker. How are you setting it to use the Lithuanian localization?

  • #4 / Aug 31, 2012 1:33pm

    Laisvunas

    879 posts

    Hi Kevin,

    I tried to localize Datepicker fieldtype using code found in solutions referrred in this Forum Post.

    Everything works except dateFormat parameter which does not allow to set format for hours, minutes and seconds.

    I would not try to use dateFormat in case default date formatting worked consistently.

    But, as I described in the point 2 of my first post in this thread, in Safecracker entry date at first is being displayed containing hour numbers having leading zeroes, but after picking of the date hour numbers loose leading zeroes (Datepicker is not localized here).

    Look at the attached images. One displays how entry date field looks before picking of the date, and second picture displays how date field looks after picking of the date. Notice the loss of the leading zero in hours number.

  • #5 / Sep 05, 2012 10:20am

    Laisvunas

    879 posts

    Hi again,

    Where you are?

    Is the loss of leading zero in hours number a bug?

  • #6 / Sep 05, 2012 2:38pm

    Dan Decker

    7338 posts

    Hi Laisvunas,

    Not only are you losing the leading zero, but the seconds are truncated as well.

    Where are you making your localization changes? Making those changes for your needs is similar to changing ExpressionEngine Core.

    Since the changes have to be made outide of options available in the Control Panel or /system/expressionengine/config/ we can’t directly support it. I’d be happy to move this over to Development and Programming though?

    Thanks!

  • #7 / Sep 06, 2012 1:30am

    Laisvunas

    879 posts

    Please, don’t move this to Development and Programming because I’m asking not only about localization, but also about issues which might be result of the bugs.

    If I remove my localization code the issue of lost leading zero in hours number in Safeckracker remains: in entry date at first there is leading zero, but after picking of the date leading zero is lost (see images in my previous post).

    I use EE v2.5.2 Build Date: 20120606

  • #8 / Sep 07, 2012 2:43pm

    Kevin Smith

    4784 posts

    You’re right, Laisvunas, that does indeed look like it’s a problem for EE regardless of the localization. I’ve filed a bug for that particular issue here.

    While this is certainly unexpected behavior, I’m actually unclear about what problems this actually causes for you. You said in your initial post that you needed to have dates displayed consistently. When you lose the leading zero on the hour, is this causing issues for you? Could you go into some detail about the problems it’s causing?

  • #9 / Sep 07, 2012 3:00pm

    Laisvunas

    879 posts

    The loss of both leading zero in hours number and of seconds number confuses users of Safecracker form. After picking of the date they see the date in unexpected format and wonder if everything is correct - should they leave the value which was entered by javascript or should they correct the value manually. And the manual entering of the date often leads to unexpected results.

  • #10 / Sep 10, 2012 2:50pm

    Dan Decker

    7338 posts

    Hi Laisvunas,

    My apology for not getting the full grasp of your issue.

    We really appreciate your explanation. Understanding how this affects you is important too.

    With the bug filed, is there anything else I can help you with?

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases