flatpressblog / flatpress

FlatPress is a lightweight, easy-to-set-up flat-file blogging engine.
https://flatpress.org
GNU General Public License v2.0
185 stars 57 forks source link

Wrong time for 'Welcome' entry #99

Closed bttrx closed 7 months ago

bttrx commented 2 years ago

Hi!

I installed fp-1.2.1 to a Synology DiskStation. During setup FlatPress creates a 'Welcome' entry to showcase some features. I did the setup at 7pm CEST and that's also what the DiskStation's file manager shows for the modified date of the corresponding entry*.txt file. But in FlatPress' frontend and backend this entry is shown as it was created at 5pm. Filename on the DiskStation is entry220418-170052.txt. DATE timestamp inside the .txt file is 1650301252. According to https://unixtime.org/ this represents 'GMT | Mon Apr 18 2022 17:00:52 GMT+0000' or 7pm CEST. A user creating his/her first entry now, will get 7:..pm for that entry and is probably confused by the 2-hour difference.

FP's ships with a time offset of 2 hours. This offset should also be applied when creating the 'Welcome' entry. Best would probably be to already ask the user during setup for the right time offset.

bttrx commented 2 years ago

As we are already talking about the 'Welcome' entry:

  1. The author for this entry should be set to 'FlatPress'. Otherwise using the Leggero theme it reads: 'Posted by at 17:00:52'.
  2. A typo to fix: 'sourrounding' -> 'surrounding'.
azett commented 2 years ago

Thanks for reporting! Current status:

Possibly related to #113 and #116!

Fraenkiman commented 7 months ago

I could not reproduce the problem with RC1. The welcome entry is created with the UTC time (Germany/ winter time). @bttrx, can you still reproduce the problem with FlatPress 1.3 RC1?

bttrx commented 7 months ago

I don't use FP anymore.

Fraenkiman commented 7 months ago

@bttrx It rings a bell. That's a shame. You always see each other twice. I would be delighted if you could join us again.

All the best

Fraenkiman commented 7 months ago

@azett and @deltalima: Please check whether the problem still exists. I can no longer reproduce it with RC1.

Note: FlatPress uses UTC and a time offset, which can be changed decimally in the admin area.

If the problem is no longer reproducible, please inform the cleaning lady

Fraenkiman commented 7 months ago

Addition (time welcome entry): Seems a bit problematic to work with the timeoffset 2 by default in the welcome entry. We still distinguish between winter and summer time - how old-fashioned. The time() function uses the default timezone from php.ini. If this is set correctly, we have no problem here. The setup uses the time() function, so I could not reproduce the error on my test system. https://github.com/flatpressblog/flatpress/blob/71ba1bc9309aa516d9ec514a0375b561a890f6ba/setup/lib/step2.lib.php#L14 On the other hand, it is the welcome entry, which is deleted before productive operation. Newly created entries are created with UTC + timeoffset.

azett commented 7 months ago

Tested this with latest FP. PHP runs in time zone "Europe/Berlin" / CET / UTC+1. FlatPress installed at 11:37 local time.

Welcome entry says "Posted by FlatPress at 10:37:24", so its generation time is still set in UTC.

More important: New entry added at 11:40 local time, but is displayed as "Posted by admin at 12:40:31". The installer has set the time offset to "2", but should have set "1" (CET) until Mar 31. After that, "2" would be correct (CEST).

Edit: Added this to the 1.3 milestone.

azett commented 7 months ago

@Fraenkiman @DeltaLima Can you please check if my 9f71fcc works properly, maybe with different date.timezone settings in php.ini? Thanks a lot :)