Timezones and Sch.plugin.CurrentTimeLine

Ask for help related to our 2.x versions.
Post Reply
User avatar
svycka
Posts: 22
Joined: Fri Jun 15, 2012 8:12 am

Timezones and Sch.plugin.CurrentTimeLine

Post by svycka » Mon May 06, 2013 12:46 pm

Can I somehow set offset or timezone for Sch.plugin.CurrentTimeLine it works fine with current PC time But I have different time zones and I want to show time in these time zones not my PC time.

User avatar
mats
Core Developer
Core Developer
Posts: 14100
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

Re: Timezones and Sch.plugin.CurrentTimeLine

Post by mats » Mon May 06, 2013 1:14 pm

No, any date manipulation for the incoming data will have to be handled by the implementor. The component simply renders what you tell it to render.
Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

User avatar
svycka
Posts: 22
Joined: Fri Jun 15, 2012 8:12 am

Re: Timezones and Sch.plugin.CurrentTimeLine

Post by svycka » Mon May 06, 2013 1:21 pm

i see now I overridden plugin and added timezone offset config option and looks like its working thanks anyway

User avatar
ccopleston
Posts: 34
Joined: Tue Feb 28, 2017 7:25 pm

Re: Timezones and Sch.plugin.CurrentTimeLine

Post by ccopleston » Wed Apr 10, 2019 1:14 pm

Hi @svycka,

I'm trying to do the same thing.

Did you get this working? If so could you share your code or point me in the right direction?

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 1702
Joined: Fri Apr 01, 2016 11:08 am

Re: Timezones and Sch.plugin.CurrentTimeLine

Post by pmiklashevich » Thu Apr 11, 2019 8:39 pm

Hello @ccopleston,

Please try

Code: Select all

Ext.define('CurrentTimeLineWithOffset', {
    extend : 'Sch.plugin.CurrentTimeLine',
    alias  : 'plugin.currenttimelinewithoffset',

    init : function() {
        var me = this,
            autoUpdate = me.autoUpdate;

        me.autoUpdate = false;
        me.callParent(arguments);
        me.autoUpdate = autoUpdate;

        var record = me.store.first();

        if (me.autoUpdate) {
            me.timer = setInterval(function() {
                me.updateDate();
            }, me.updateInterval);
        }

        me.updateDate();
    },

    updateDate : function() {
    // TODO: set the date you want, with offset or not
        this.store.first().set('Date', new Date(2017, 0, 10, 12));
    }
});

new Sch.panel.SchedulerGrid({
    plugins : [
        { ptype : 'currenttimelinewithoffset' }
    ],
    ...
})
I've updated the sources so after next nightly build and next release you can simplify your override:

Code: Select all

Ext.define('CurrentTimeLineWithOffset', {
    extend : 'Sch.plugin.CurrentTimeLine',
    alias  : 'plugin.currenttimelinewithoffset',

    updateDate : function() {
        this.store.first().set('Date', new Date(2017, 0, 10, 12));
    }
});
Another option is to extend Sch.plugin.Lines and create your own plugin with the logic you need. Please see the sources of Sch.plugin.CurrentTimeLine class for reference.

Best regards,
Pavel
Pavel Miklashevich - Core Developer

Post Reply