• Resolved tobias1hdw

    (@tobias1hdw)


    Hi,

    we have currently a big problem with the plugin. We are not able to get the time and date formatting from WordPress working. We’ve got an european format here (dd.mm.yyyy & 24-h hh:mm) and in the settings its set to “Use WordPress Date/Time format”. But in the calendar it is still written with am/pm.

    Is there a simple way to debug this or is it generally broken currently?

    If there is any way to support you to find a solution, we’ll be really happy to do this!

    Here the technical informations:
    PHP Version: 7.4.27
    Wordpress Version: 5.9
    Plugin Version: 14.30
    Current Theme: green-care-academy
    Application Used: Our Official Application
    Active Plugins:
    Advanced Custom Fields PRO
    Borlabs Cookie – Cookie Opt-in
    Contact Form 7
    Enable Media Replace
    Flamingo
    InfiniteWP – Client
    Loco Translate
    MultilingualPress
    Redirection
    Regenerate Thumbnails
    reSmush.it Image Optimizer
    WP GoToWebinar
    WP Mail SMTP
    WP Migrate DB Pro
    WP Ultimate CSV Importer Pro
    Yoast Duplicate Post
    Yoast SEO

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    Hi @tobias1hdw,

    Is the issue that in the calendar the time is displayed in 12h time? Like if we were to change this to 24 hour time would that be what you are after, or is there more to it than this?

    Thanks,

    Thread Starter tobias1hdw

    (@tobias1hdw)

    Hi @northernbeacheswebsites,

    it is exactly this!

    Example:

    Currently it is 4pm, but we are expecting 16:00.

    We thought if we use the “Use WordPress Date/Time format” option this is what should happen.

    THank you for you fast feedback ??

    Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    Hi @tobias1hdw,

    So the settings in the plugin only work for the table, they don’t work for the calendar. The reason for this is that the calendar is done by a javascript library whereas everything else is controlled by PHP by our plugin. There’s probably a way to send this setting to javascript, but that’s a little beyond my expertise.

    However, if you don’t mind, I can give you a solution, but it would break upon update, so either don’t update the plugin, or re-apply the fix upon update. If you edit script.js (wp-gotowebibar/inc/script.js) and edit line 25 and change:

    timeFormat: ‘h(:mm)a’,

    to:

    timeFormat: ‘H(:mm)a’,

    That will resolve the issue. You may need to clear your browser/site/server cache if script.js if you don’t see the change come into affect.

    I am sorry I can’t provide a more seamless solution. Thanks,

    Thread Starter tobias1hdw

    (@tobias1hdw)

    Hi @northernbeacheswebsites thank you for your fast feedback.

    I would add the fix currently to the plugin files and stop updating the plugin.

    Maybe there is a way to get this fix into the regular plugin? If you are using github, i could have a look into the code and try to get fix done. After that i could create a pull requests.

    But only if you are interested ??

    Regard,
    Tobi

    Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    Hi Tobi,

    You are welcome to send a link to an updated plugin zip and just describe how it works, and I can then put this into the next release if you want.

    Thanks,

    Thread Starter tobias1hdw

    (@tobias1hdw)

    Hi @northernbeacheswebsites,

    i’ve quickly updated two files:

    Line 5-34 on wp-gotowebibar/inc/script.js:

    if ($('#calendar').length){
            var calendarData = $('#calendar-data').attr('data');
            var calendarTimeFormatSetting = $('#calendar-data').attr('data-time-format-setting');
            var calendarTimeFormat = $('#calendar-data').attr('data-time-format-setting');
    		
    		if(calendarTimeFormatSetting == 'wordpress'){
    			calendarTimeFormat = ($('#calendar-data').attr('data-time-format')).replace('i', 'mm');
    		}
            
            var calendarDataDecodedAndParsed = JSON.parse(atob(calendarData));
            
            var wordpressLocale = document.documentElement.lang;
            
    //        console.log(calendarDataDecodedAndParsed);        
            
            $('#calendar').fullCalendar({
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay,listWeek'
                },
                navLinks: true, // can click day/week names to navigate views
                editable: false,
                height: 'auto',
                locale: wordpressLocale.substr(0,2),
                timezone: 'local',
                timeFormat: calendarTimeFormat,
                events: calendarDataDecodedAndParsed
    
            })       
        }

    Line 123 on wp-gotowebibar/inc/shortcode-calendar.php:

    $html .= '<div id="calendar-data" data="'.base64_encode(json_encode($calendarData)).'" data-time-format="'.get_option('time_format').'" data-time-format-setting="'.$options['gotowebinar_time_format'].'"></div>';

    This fixed my issue.
    I am not sure if this is a global fix, but for the calendar it could work. If this solution is fine for you, feel free to add it to your plugin ??

    Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    Thanks @tobias1hdw, I will look over this and put in the next version. Thanks for your work ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Date & Time format’ is closed to new replies.