20 Posts
Olek
11 years ago
16
Topic

Hello! I'm using Seblod 3.1.5 with Joomla 2.5.14 and have problems with calendar plugin. Apparently it uses UTC instead of local time, which causes 2 hours difference while creating new content. In old Seblod Forum I found 'corrected' calendar.php file, which worked great and doesn't terrorize me with that UTC. 

However, it's for Seblod 2.x and doesn't work quite good in Seblod 3.x. I mean - it pastes correct time while creating new content, but completely fails when I try to use it in my Search type (the search type ignores all my date filters based on calendar).

So... is there any chance to add option to choose UTC/local time in calendar plugin? Or maybe would someone be so kind and change it in calendar.php from UTC to local time, as I'm not a PHP master and can't do it myself? I bet there are / will be more people with this issue.

Get a Book for SEBLOD
20 Posts
Olek
11 years ago
1
Level 1

Well, AGAIN nobody here cared to help (well, it's the fifth or sixth time I ask anything - never got any answer), but somehow I got to find a workaround for this issue (because for me basing on UTC is an issue). I just looked closely at the modified calendar.php for Seblod 2.x and transfered all the changes from there to calendar.php in my Seblod 3.1.5 - tadaa, it's working as it should. I don't enclose this file, as I'm not author of the original additional lines. But if you really want it, I can still send it to you directly.

And again - for me the case is not solved, as I'd have to overwrite the file manually after every Seblod update.

For everybody thinking I'm a total noob who doesn't know that putting 'now' as default value in calendar plug-in is the ultimate solution: well... no. It's ok when you're creating new article, but when you edit native joomla article to convert it this way into Seblod article - well, here we go, the dates 'created' and 'publish up' go back 2 hours. When you had by default set time to 00:00:00, Seblod changes it 22:00:00 - the previous day. And of course all searching by date starts to mess.

215 Posts
cubist
10 years ago
0
Level 2

Yes, I need this too! Please send me the file. Thanks much!

332 Posts
Kenneth
9 years ago
0
Level 1

Was this solved? I found something over at https://github.com/Octopoos/SEBLOD/pull/15/ but I cant get it to work.

332 Posts
Kenneth
9 years ago
0
Level 1

The MySQL is in UTC 00:00, so everything I save get's added to the database with wrong time.

I'm in Oslo (+1), so I'm off by one hour.

When I store a core Joomla article, the time is still off by 1 hour. But somehow, a plugin or a code somewhere adjusts the time according to Joomla offset.

This is not happening in Seblod. I've made an "event app", and I put in a unpublish date, to make it stop showing when the event has happend but it still shows for 1 hour before it unpublishes.

I've seen a lot of threads in the forum, a few trackers and a pull on GitHub for this problem. (That Seblod accounts for UTC standard, and not the Joomla offset settings).

I've played with offset settings in Joomla, tried to use commands to alter MySQL global timezone (not allowed by host), added php.ini with timezone override.

I've first used the calendar field, then dropped it, removed all created contents logged out and added the core joomla publish down field. Same result. I've done just about everything I can do.

Core Joomla created articles work with the core joomla publish down field. It seems there are done some calculations on the date entered that care about the Joomla offset settings.

This isn't happening with Seblod calendar fields, not core or created calendar fields.

Any suggestions? 

4229 Posts
Kadministrator
9 years ago
2
Level 1

Problem is in Seblod using php time functions directly instead of using joomla functions that have this adjustment.

332 Posts
Kenneth
9 years ago
1
Level 2

How can I work around this?

4229 Posts
Kadministrator
9 years ago
0
Level 3

Php functions rely on timezone setting, so only way to adjust it is to change timezone.

332 Posts
Kenneth
9 years ago
0
Level 1

Do you mean they rely on timezone settings of the MySQL database?

If not: how?

20 Posts
Olek
9 years ago
2
Level 1

Well, I can't code, I don't know PHP, but managed to merge custom code from SEBLOD 2 into SEBLOD 3 calendar plugin and - guess what - it works as it should. I am NOT author of the custom snippets inserted into this php file, I'm just enclosing this attachment to make your life easier. Unpack ZIP and overwrite the calendar.php in your Joomla directory. Oh, and also have in mind that every new update will restore the unmodified version of the file...

4229 Posts
Kadministrator
9 years ago
0
Level 2

Hi,

I made a pull request with your changes on github so hopefully also others can benefit from this

https://github.com/Octopoos/SEBLOD/pull/22

35 Posts
julien
9 years ago
0
Level 2

Thanks Olek and Klas. Your code work like a charm. Very usefull to keep joomla manage the time. I hope the seblod team upgrate their field calendar with this kind of function. A select button on calendar configuration with two options (Offset Joomla Time - Local Time) shoul be very nice!

332 Posts
Kenneth
9 years ago
0
Level 1

When will this be included in the core of Seblod?

7 years ago
3
Level 1

Hi

It seems the bug remains at least in the search forms.

In the submission forms the calendar field displays the time with the time zone offset even if the date that is stored in the database is in GMT.

but in the search form with the same calendar field the time zone offset is not taken into account.

Do you confirm please ?

thanks

cyril

4229 Posts
Kadministrator
7 years ago
2
Level 2

There is a big pull request to fix calendar problems

https://github.com/Octopoos/SEBLOD/pull/199

7 years ago
1
Level 3

Hi Klas

do you know if all these change will be included in the next release please ?

thanks

cyril

4229 Posts
Kadministrator
7 years ago
0
Level 4

It is tagged as 3.11, so it should be... But I am not the right person to answer this.

Get a Book for SEBLOD