BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

Provide precise time in Revisions

Open 10935336 opened this issue 2 years ago • 4 comments

Describe the feature you'd like

  • Provide precise time and relative time in revisions.
  • ~~Provide the creation and modification time at page details~~ (I noticed that the unlocalized precise time can be seen when hovering over the relative time of page details, but revisions cannot. )
  • Use another time format or make the time format adjustable, the current time format in audit is fine (2022-07-22 21:56:51).

Describe the benefits this would bring to existing BookStack users

Sometimes, I need to use the precise time of page modification. For example, if I want to mark that this article was published on a certain day, the information may be out of date. But I go to the page and I can only see inaccurate information like 2 years ago. So I had to go into the database to see the exact time. In addition, we also need precise time when resolving some collaborative conflicts

Can the goal of this request already be achieved via other means?

Deep in the database.

Have you searched for an existing open/closed issue?

  • [X] I have searched for existing issues and none cover my fundemental request

How long have you been using BookStack?

1 to 5 years

Additional context

image image

10935336 avatar Jul 22 '22 14:07 10935336

Hi @10935336, This is how that appears on my instance:

Screenshot 2022-07-25 at 15 00 34

Date localization is handled by PHP and the locales on the host system. You may need to ensure that the relevant language locales are installed on the host system.

ssddanbrown avatar Jul 25 '22 14:07 ssddanbrown

Hi @10935336, This is how that appears on my instance:

Screenshot 2022-07-25 at 15 00 34

Date localization is handled by PHP and the locales on the host system. You may need to ensure that the relevant language locales are installed on the host system.

The exact time is not displayed on my instance, after looking at your picture,Tried switching to English and other languages, it did work. But no matter if I switch to Simplified Chinese or Traditional Chinese, only relative time is displayed.

I've tried multiple devices and browsers, but all only show relative time. So it's presumably not a client-side issue. Do have multiple locales on the host system and display mostly in Chinese.

output
[root@ ~]# locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC=zh_CN.UTF-8
LC_TIME=zh_CN.UTF-8
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY=zh_CN.UTF-8
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER=zh_CN.UTF-8
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT=zh_CN.UTF-8
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=
[root@ ~]# locale -a | grep zh_CN
zh_CN
zh_CN.gb18030
zh_CN.gbk
zh_CN.utf8

Do you have any ideas?

10935336 avatar Jul 25 '22 16:07 10935336

@10935336 How are you running BookStack? What operating system are you using on the host machine?

ssddanbrown avatar Jul 25 '22 17:07 ssddanbrown

How are you running BookStack? What operating system are you using on the host machine?

  • Direct hosting, not containers or shared hosting
  • BookStack v22.06.2
  • RHEL 8

Update: After looking at the source code, I noticed that the same formatLocalized('%e %B %Y %H:%M:%S') is used in the export system So I tried to export the page in HTML and I ended up with the following image

Edit: Given that the issue has been resolved, some details have been removed as it may affect system security.

10935336 avatar Jul 26 '22 07:07 10935336

I have a similar problem. In Russian.

Statium avatar Aug 15 '22 08:08 Statium

I done some deeper testing of this today, by creating a fresh RHEL-based install, and I can confirm this behaviour. It seems to be caused by a non-UTF8 locale being used by BookStack, when the system default encoding for a locale is not utf8. We can updated the behaviour to prioritise usage of utf8-based locales. Have assigned to the next feature release and updated the title to align.


Note to self for changes

Need to updated this:

https://github.com/BookStackApp/BookStack/blob/b4f29a85abada669001fdc0fcc5974a7b7c163b8/app/Http/Middleware/Localization.php#L136-L139

To attempt utf8 usage first, so swtich these around. Have tested this solution. Can just provide list of locales to setlocale instead of having the if statement (docs).

ssddanbrown avatar Aug 22 '22 14:08 ssddanbrown

Behaviour has now been amended in 9158a66bff8fa50640eef7ac8830d47b7fb72c02 and will be part of the next feature release.

ssddanbrown avatar Sep 02 '22 18:09 ssddanbrown