Link to the mod (https://custom.simplemachines.org/index.php?mod=4235)
Relative Time Formats
For SMF 2.1.x
Tested only with the SMF default theme!
With this mod can the admin decide how to set the default display of time and date format with a relative one, such as 1 minute ago, 4 hours ago or Sunday at 10:20 etc.
Individual members can always override these defaults in the "Look and Layout" section of their profile settings
License
* This SMF modification is subject to the BSD 2-Clause License
Admin settings
- Admin->Features and Options->General
User settings
- Profile->Look and Layout
Languages
- English
Changelog
Version 1.2.2 - Dec 7, 2023
- Fixed logical operators for output timeformat
Version 1.2.1 - Feb 22, 2022
- Fixed post linking calender and previews
Version 1.2 - Feb 16, 2022
- Fixed that this mod does not break the calendar page
Version 1.0.1 - Jul 19, 2021
- Updated installation package to handle more RC releases without emulation
Version 1.0 - May 30, 2019
- Initial Release
Very good and I leave the translation to Latin Spanish 8)
Regards!
This is going to be a huge mod for theme devs. I have been looking for this for 2.0. Nice work.
I have this latest version installed on 2.1.1...
Getting this error:
Error
Type of error
General
Error message
2: preg_replace(): Compilation failed: range out of order in character class at offset 521
File
/home2/*****/public_html/*****/Sources/RelativeTimeFormats.php
Line
177
URL of page causing the error
https://*****.com/index.php?action=admin;area=downloads;sa=logs;cc63d4c0=67056017d3553d5efdf36fc98d4ce724
Backtrace information
#0: smf_error_handler()
Called from unknown on line -1
#1: preg_replace()
Called from /home2/*****/public_html/*****/Sources/RelativeTimeFormats.php on line 177
#2: rtf_integrate_buffer()
Called from unknown on line -1
The only thing I changed after installing was...
Display time and date format as: (To) Relative based on 'Month Day, Year HH:MM am/pm'
Also just noticed that with this mod installed the popup dates in the calendar do not work. Like when adding an event in the calendar you click on the date and it usually pops up with a mini calendar to choose the date but it don't work with this installed.
Just to check, I uninstalled it and the calendar dates worked fine then I reinstalled it and the calendar date stopped working.
Quote from: Shades. on February 15, 2022, 07:18:31 PMI have this latest version installed on 2.1.1...
Getting this error:
Error
Type of error
General
Error message
2: preg_replace(): Compilation failed: range out of order in character class at offset 521
File
/home2/*****/public_html/*****/Sources/RelativeTimeFormats.php
Line
177
URL of page causing the error
https://*****.com/index.php?action=admin;area=downloads;sa=logs;cc63d4c0=67056017d3553d5efdf36fc98d4ce724
Backtrace information
#0: smf_error_handler()
Called from unknown on line -1
#1: preg_replace()
Called from /home2/*****/public_html/*****/Sources/RelativeTimeFormats.php on line 177
#2: rtf_integrate_buffer()
Called from unknown on line -1
The only thing I changed after installing was...
Display time and date format as: (To) Relative based on 'Month Day, Year HH:MM am/pm'
sorry i have tested mod and i get no errors? Maybe you can point out on wich page this error happens...
Quote from: Shades. on February 15, 2022, 08:25:27 PMAlso just noticed that with this mod installed the popup dates in the calendar do not work. Like when adding an event in the calendar you click on the date and it usually pops up with a mini calendar to choose the date but it don't work with this installed.
Just to check, I uninstalled it and the calendar dates worked fine then I reinstalled it and the calendar date stopped working.
thx for the report and yeah the popup don't comes up, i need to fix that, also i don't get any event posted always getting -> An error has occurred Invalid date, this is without mod installed ;( weird.
Mod updated to v1.2
Changelog
Version 1.2 - Feb 16, 2022
- Fixed that this mod does not break the calendar page
Quote from: Pipke on February 16, 2022, 02:10:33 PMsorry i have tested mod and i get no errors? Maybe you can point out on wich page this error happens
According to the error log I posted it looks like https://*****.com/index.php?action=admin;area=downloads so it may be just this mod and the download mod butting heads. I'll see if it happens again...not a big deal. The bigger deal for me was the calendar popup so I'll try your update and post back thanks! 8)
Edit: Updated mods works good thank you! ;)
Quote from: Pipke on February 16, 2022, 02:57:13 PMMod updated to v1.2
Changelog
Version 1.2 - Feb 16, 2022
- Fixed that this mod does not break the calendar page
Ok this is weird cause it doesn't break the calendar date popup when creating a "NEW" event but does break it when Linking a "Posted" event to the calendar. Again I checked by uninstalling this mod and the popup calendar date works but stops working after I reinstalled this.
Quote from: Shades. on February 21, 2022, 10:32:30 PMQuote from: Pipke on February 16, 2022, 02:57:13 PMMod updated to v1.2
Changelog
Version 1.2 - Feb 16, 2022
- Fixed that this mod does not break the calendar page
Ok this is weird cause it doesn't break the calendar date popup when creating a "NEW" event but does break it when Linking a "Posted" event to the calendar. Again I checked by uninstalling this mod and the popup calendar date works but stops working after I reinstalled this.
thx for the report agian, it's fixed in new release ;)
Version 1.2.1 - Feb 22, 2022- Fixed post linking calender and previews
@Pipke works great thank you! 8)
Found another issue. With this mod installed for some reason it enlarges my forum text in certain areas. Noticably in package manage. Image 1 is without mod and image 2 is with mod and image 3 with mod shows the page "admin" (or whatever page I'm on) in top left corner of every page.
Quote from: Shades. on February 23, 2022, 07:54:00 PMFound another issue. With this mod installed for some reason it enlarges my forum text in certain areas. Noticably in package manage. Image 1 is without mod and image 2 is with mod and image 3 with mod shows the page "admin" (or whatever page I'm on) in top left corner of every page.
i already fixed that
uninstall/remove the 1.2.1 version you got now installed. And download the version 1.2.1 agian on the mod site and install that one.
Ok thanks it works great now! 8)
I was pretty sure that I had downloaded and uploaded the latest copy but I guess I didn't lol! :P
Quote from: Shades. on February 24, 2022, 05:48:02 AMOk thanks it works great now! 8)
I was pretty sure that I had downloaded and uploaded the latest copy but I guess I didn't lol! :P
i uploaded version 1.2.1 with that bug you experienced, in the mean time you downloaded it, before i fixed and uploaded the right version 1.2.1 agian. Hope i explained well ;)
Quote from: Pipke on February 24, 2022, 05:56:14 AMQuote from: Shades. on February 24, 2022, 05:48:02 AMOk thanks it works great now! 8)
I was pretty sure that I had downloaded and uploaded the latest copy but I guess I didn't lol! :P
i uploaded version 1.2.1 with that bug you experienced, in the mean time you downloaded it, before i fixed and uploaded the right version 1.2.1 agian. Hope i explained well ;)
Oh ok I see! Thanks! 8)
My date & time are showing up like this: data-rtf-time="2022-03-01 19:24:52" :o
Quote from: Shades. on March 02, 2022, 06:46:17 AMMy date & time are showing up like this: data-rtf-time="2022-03-01 19:24:52" :o
all over the website, or just some/one page?
Actually it's only on every mod that I have installed that has a date displayed but not on SMF itself. So I'll just have to do without this mod for now. :(
Quote from: Shades. on March 02, 2022, 03:46:13 PMActually it's only on every mod that I have installed that has a date displayed but not on SMF itself. So I'll just have to do without this mod for now. :(
can you provide me a link to an page where this matter happens.
Quote from: Pipke on March 02, 2022, 04:41:41 PMQuote from: Shades. on March 02, 2022, 03:46:13 PMActually it's only on every mod that I have installed that has a date displayed but not on SMF itself. So I'll just have to do without this mod for now. :(
can you provide me a link to an page where this matter happens.
Sure https://bikerhound.com/index.php?action=gallery
@Shades. thats a payed mod so i can't view the files, can you try to replace the attached file, see if it does fix the problem and let me know the outcome thanks for that.
RelativeTimeFormats.php
ps . by the Arcade mod pages it works fine! So the cultprit is at the Gallery pro mod somewhere!
Quote from: Pipke on March 02, 2022, 05:11:28 PMps . by the Arcade mod pages it works fine! So the cultprit is at the Gallery pro mod somewhere!
Also the "Badges" mod too.
Quote from: Pipke on March 02, 2022, 05:11:28 PM@Shades. thats a payed mod so i can't view the files, can you try to replace the attached file, see if it does fix the problem and let me know the outcome thanks for that.
Dang, no that didn't fix it either. I would think that the SMF Gallery Lite (https://custom.simplemachines.org/index.php?mod=473) mod would be similar. Can you look at those files?
@Shades. on the lite version all works well, see attachment screeny
gallery lite relative time ok.png
Hmm...ok well
What should I look for in the pro version to see what calls the time?
Edit: Also weird cause it works fine on the Badges mod display at the bottom of my forum page (image 1) but not in the profile display of badges. (image 2)
p.s. I notified the gallery & badge mod author so maybe they can help too. ;)
Well the SMF Gallery mod author said it uses the built in SMF function timeformat so I dunno. It also doesnt work right in the store mod or the downloads in the logs and myfiles areas. I guess they're just not compatible. :'(
Great mod though I still use it on my other sites that don't have these particular mods installed. ;)
Thanks,
Shades 8)
This seems to work great for me... EXCEPT it breaks the high-score tables a bit for the ARCADE mod.
:(
The ranking (which have a mouse-over which shows time/date info of when the high score was set, etc) is broken showing code.
I suspect it's that mouse-over code that is the culprit, but what do I know? I only pretend to know what I am talking about around here... when I do.
:D
@Shades. @FrizzleFried the basic code of this mod is that it transforms the "default SMF function time format" to a relative format, it's so simple as that...it could be anything how other mods are built up that it will fail on some pages. It's hard to figure out that 'this' mod will work with all other mods, wouldn't that be great ;)
Yeah, I suspected that was the case. Not a big deal. I just can't run the mod as I do run the Arcade mod.
I may have noticed a bug?
I noticed on my board (I'm using the Default theme), the MOD installed and defaulted to Day, Month, Year 24 hour. I changed it to Month Day, Year 24 Hour, and noticed it didn't change anything. I've forced a refresh, and Emptied SMF Cache. Still no difference, it's still showing my dates as like 24 November.
I tried it with Month Day, Year 12 hour and it works just fine.
Quote from: Senkusha on December 07, 2023, 11:31:50 AMI may have noticed a bug?
I noticed on my board (I'm using the Default theme), the MOD installed and defaulted to Day, Month, Year 24 hour. I changed it to Month Day, Year 24 Hour, and noticed it didn't change anything. I've forced a refresh, and Emptied SMF Cache. Still no difference, it's still showing my dates as like 24 November.
I tried it with Month Day, Year 12 hour and it works just fine.
yeah its a bug, thanks for finding that... ill fix it later.
By the way the Month Day, Year am/pm works ;)
Mod updated with the fix latest is now v1.2.2
I may have found an issue. Whenever I modify a post, I see the following in my error log:
RTF_error.png
Quote from: Senkusha on December 12, 2023, 05:02:27 PMI may have found an issue. Whenever I modify a post, I see the following in my error log:
RTF_error.png
I made some changes and I hope this will fix your error. Download the file in the attachment and overwrite it in your Sources folder. Can you please respond if it is resolved.
Okay, I tested, creating a message, and modifying a message. Both produce no errors. I also tested a longer drafted message that engaged the Auto Save feature. This did not produce any errors either!
Thank you!