Jump to content

Unicalendar regional settings


Recommended Posts

How to setup regional setting for UniCalendar component or change time display (1pm = 13h)?

 

Hi!

 

If you mean "UniCalendarPanel1"...

 

I know that there is a better solution, It may be not yet complete solution, but try:

 

MainForm -> ClientEvents -> UniEvents add function window.beforeInit

 

the key point is a string:

times.push(Ext.Date.format(dt, 'G:i')); // default 'ga'
function window.beforeInit(sender)
{
 Ext.calendar.template.DayBody.override({
    
            constructor: function(config){
        
                Ext.apply(this, config);

                Ext.calendar.template.DayBody.superclass.constructor([
                    '<table class="ext-cal-bg-tbl" cellspacing="0" cellpadding="0">',
                '<tbody>',
                    '<tr height="1">',
                        '<td class="ext-cal-gutter"></td>',
                        '<td colspan="{dayCount}">',
                            '<div class="ext-cal-bg-rows">',
                                '<div class="ext-cal-bg-rows-inner">',
                                    '<tpl for="times">',
                                        '<div class="ext-cal-bg-row">',
                                            '<div class="ext-cal-bg-row-div ext-row-{[xindex]}"></div>',
                                        '</div>',
                                    '</tpl>',
                                '</div>',
                            '</div>',
                        '</td>',
                    '</tr>',
                    '<tr>',
                        '<td class="ext-cal-day-times">',
                            '<tpl for="times">',
                                '<div class="ext-cal-bg-row">',
                                    '<div class="ext-cal-day-time-inner">{.}</div>',
                                '</div>',
                            '</tpl>',
                        '</td>',
                        '<tpl for="days">',
                            '<td class="ext-cal-day-col">',
                                '<div class="ext-cal-day-col-inner">',
                                    '<div id="{[this.id]}-day-col-{.:date("Ymd")}" class="ext-cal-day-col-gutter"></div>',
                                '</div>',
                            '</td>',
                        '</tpl>',
                    '</tr>',
                '</tbody>',
            '</table>'
                ]);
            },

            // private
            applyTemplate : function(o){
                this.today = Ext.calendar.util.Date.today();
                this.dayCount = this.dayCount || 1;
        
                var i =0,
                    days = [],
                    dt = Ext.Date.clone(o.viewStart),
                    times = [];
            
                for(; i<this.dayCount; i++){
                    days[i] = Ext.calendar.util.Date.add(dt, {days: i});
                }

                // use a fixed DST-safe date so times don't get skipped on DST boundaries
                dt = Ext.Date.clearTime(new Date('5/26/1972'));
        
                for(i=0; i<24; i++){
                    times.push(Ext.Date.format(dt, 'G:i'));
                    dt = Ext.calendar.util.Date.add(dt, {hours: 1});
                }
        
                return this.applyOut({
                    days: days,
                    dayCount: days.length,
                    times: times
                }, []).join('');
            }
        });
}

post-906-0-63286400-1433447659_thumb.png

 

Best regards!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...