Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Hj Ahmad Rasyid Hj Ismail on July 17, 2014, 03:47:03 PM

Title: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on July 17, 2014, 03:47:03 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=3892)

ReTAD - Relative Time And Date
- For SMF 1.1.x, 2.0.x and 2.1.x
- Non-Hook, Fully File Modifications.

1. Please do your own backup though every installation is backed up automatically.
2. This mod will try to improve normal SMF displayed time and date to a more relative one.
3. You may see post as just now, x minutes, hours, days, weeks or even year ago.
4. You can set this in forum as follows:
    a. Go to Admin CP > Features & Options > Layout & Options > Enable "Today" feature
    b. Select Relative Time And Date.
    c. Save your configuration.
5. You can test it in lower SMF version as well as SMF 2.1 too as it should work just fine. ;)

Thank you for using it.


Yours friendly,
Abu Fahim Ismail.

BSD License. Feel free to modify accordingly but keep author's link if it is in there somewhere. ;)

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fvalidator.w3.org%2Fimages%2Fvalid_icons%2Fvalid-xhtml10&hash=f3694497572838dc55641db875ff57107ebabaed)  (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fjigsaw.w3.org%2Fcss-validator%2Fimages%2Fvcss&hash=710d7530f8727db53c62cb8f44abbef39967e693)

#Change log
@Version 1.2.3.1
-  Adding Italian language support, thanks to Ataru Moroboshi.

@Version 1.2.3
-  Fix reported error for not displaying correct a week / 1 week, thanks to Shuban.

@Version 1.2.2
-  Fix reported error for not displaying correct 2nd/3rd day, thanks to Shuban.

@Version 1.2.1
-  Fix reported error for not displaying correct 2nd day thanks to DSystem.
- Added Brazilian language thanks to DSystem.

@Version 1.2.0
-  Fix reported error for not displaying correct number of month and year thanks to Shuban.

@Version 1.1.1
- Added Spanish, Dutch & Malay languages thanks to 4Kstore & Soft Drink respectively.

@Version 1.1
- Changed on to about for $txt['on'] via language file Modifications.english.php.

#Note:
1. Translators can add up language by posting in the support page for this mod.
2. Only a complete language translation for both with details and without details packages will be add in the next updates. I will try to help a bit on this. ;)
Title: Re: Improved Displayed Times (Facebook Styles)
Post by: Matthew K. on July 17, 2014, 04:09:40 PM
Very nice mod, glad to see it's approved!

Just as a reference...to stay to SMF's coding style, you'd never do:
if($day_itv < 2) return $txt['itv_day'] . timeformat($log_time, $today_fmt, $offset_type);
You'd always want to break that up into two lines. Just keeps it more clean and organized to see what's going on. You'd also want a space between if and ().

Regards
Title: Re: Improved Displayed Times (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on July 17, 2014, 04:37:30 PM
Thank you for the feedback. I will take a note of that and improve it in the next version. Thanks again.
Title: Re: Improved Displayed Times (Facebook Styles)
Post by: 4Kstore on July 19, 2014, 09:07:31 PM
This is a great mod.

My contribution: spanish_latin translation

$txt['itv_years'] = 'hace años';
$txt['itv_months'] = 'hace meses';
$txt['itv_weeks'] = 'hace semanas';
$txt['itv_days'] = 'hace días';
$txt['itv_hours'] = 'hace horas';
$txt['itv_minutes'] = 'hace minutos';
$txt['itv_year'] = 'Hace un año';
$txt['itv_month'] = 'Hace un mes';
$txt['itv_week'] = 'Hace una semana';
$txt['itv_day'] = 'Hace un día';
$txt['itv_hour'] = 'Hace una hora';
$txt['itv_minute'] = 'hace Un minuto';
$txt['itv_second'] = 'Recién!';
$txt['improved_times'] = 'Improved Displayed Times';


Title: Re: Improved Displayed Times (Facebook Styles)
Post by: Charles Waters on July 23, 2014, 12:54:14 PM
Hey all:

I have a question about something related to this mod, but not exactly this mod (okay - now that you are as confused as I am by the way that sounded)...

I installed this GREAT mod, but I would like to do one more thing...

So now, the subs are set up looking like this:

Re: Testing
« Reply #3 on: 13 hours ago »


I would *really* love to be able to change it to this:

Re: Testing
« Reply #3: 13 hours ago »


Basically, getting rid of the "on" that is there. I have searched through a few of the source files where I would *think* the call to the "on: " would be, and I can not find it ANYWHERE.

Can anyone point me in the right direction?

Thanks in advance for the help, and thanks for an AWESOME mod!
Title: Re: Improved Displayed Times (Facebook Styles)
Post by: samborabora on July 23, 2014, 01:48:12 PM
Quote from: Charles Waters on July 23, 2014, 12:54:14 PM
Hey all:

I have a question about something related to this mod, but not exactly this mod (okay - now that you are as confused as I am by the way that sounded)...

I installed this GREAT mod, but I would like to do one more thing...

So now, the subs are set up looking like this:

Re: Testing
« Reply #3 on: 13 hours ago »


I would *really* love to be able to change it to this:

Re: Testing
« Reply #3: 13 hours ago »


Basically, getting rid of the "on" that is there. I have searched through a few of the source files where I would *think* the call to the "on: " would be, and I can not find it ANYWHERE.

Can anyone point me in the right direction?

Thanks in advance for the help, and thanks for an AWESOME mod!

Check your Display.template.php for:

<div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div>

I believe if you change this to:
<div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ':</strong> ', $message['time'], ' &#187;</div>

:D
Title: Re: Improved Displayed Times (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on July 23, 2014, 08:18:06 PM
Thank you for your feed back and suggestion. I will try to add this in the next update. I will check whether private message have the same thing because basically, it is almost similar with Display.template.php. May be, I consider removing it from language file instead. I will see which one is efficient and better.
Title: Re: Improved Displayed Times (Facebook Styles)
Post by: Charles Waters on July 23, 2014, 08:45:06 PM
Quote from: samborabora on July 23, 2014, 01:48:12 PM
Check your Display.template.php for:

DAMN IT!!! I didn't even see that file... Son of a ________________ (<-- insert favorite curse word here).
Title: Re: Improved Displayed Times (Facebook Styles)
Post by: iorkara on July 26, 2014, 12:19:31 AM
Installed this Mod, brilliant work.

Thank you.
Title: Re: Improved Displayed Times (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on July 26, 2014, 01:12:49 AM
Thank you for the feedback.

I am still figuring out whether to remove $txt['on'] from language file or otherwise will have to mod 16 places in default templates. Simply removing txt['on'] from the language file will unfortunately leave a blank empty space. While modifying 16 places seems quite tedious. I guess I will just have to replace it with a "-" for the time being.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on July 27, 2014, 12:44:10 AM
Updated.

#Change log
Version 1.1
Change on to about for $txt['on'] via language file Modifications.english.php.

Note:
1. Translator can add up language by posting in the support page for this mod.
2. Only a complete language translation for both with details and without details packages will be add in the next updates.
3. Old packages are removed.

Thanks 4Kstore. But I will need translations for both packages instead of just one. Please update the translations so I could package them up together.
Quote from: 4Kstore on July 19, 2014, 09:07:31 PM
This is a great mod.

My contribution: spanish_latin translation

$txt['itv_years'] = 'hace años';
$txt['itv_months'] = 'hace meses';
$txt['itv_weeks'] = 'hace semanas';
$txt['itv_days'] = 'hace días';
$txt['itv_hours'] = 'hace horas';
$txt['itv_minutes'] = 'hace minutos';
$txt['itv_year'] = 'Hace un año';
$txt['itv_month'] = 'Hace un mes';
$txt['itv_week'] = 'Hace una semana';
$txt['itv_day'] = 'Hace un día';
$txt['itv_hour'] = 'Hace una hora';
$txt['itv_minute'] = 'hace Un minuto';
$txt['itv_second'] = 'Recién!';
$txt['improved_times'] = 'Improved Displayed Times';

Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: gaurav09 on August 13, 2014, 08:03:52 AM
why "With details of time for a day to years." mod dropped   :o :o :o

i have installed this one,..is it giving any major error  ??? :o ???

should i uninstall it  ??? ??? ???
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on August 13, 2014, 09:04:51 AM
No. So far that I have tested, it is has no trouble at all. I just don't feel there is necessity to maintain it beside it gives confusion to people who use this mod. I think it is better of with no details at all rather than one gives some time details and the other does not.

I will put it back in the mod page if anybody still need it. So sorry for the confusion.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: gaurav09 on August 13, 2014, 11:39:03 PM
Quote from: ahrasis on August 13, 2014, 09:04:51 AM
No. So far that I have tested, it is has no trouble at all. I just don't feel there is necessity to maintain it beside it gives confusion to people who use this mod. I think it is better of with no details at all rather than one gives some time details and the other does not.

I will put it back in the mod page if anybody still need it. So sorry for the confusion.
oh i was very scared  :'( :'( :'(
do not do these things in future  :'( :'( :'(
i am very scared  >:(
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on August 14, 2014, 12:26:07 AM
So sorry. It shouldn't be scary or anything.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Rain Forest on August 14, 2014, 04:58:17 AM
Hey Ahraris :)

Thanks for the nice mod!

How do I remove the time date from boardindex (smf 2.0.8)?

For example
about A week ago at 05:06:58 PM

to: about A week ago
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on August 14, 2014, 05:06:47 AM
Uninstall. Use ImprovedDisplayedTimesNoDetailsV11.zip instead. The one you used is ImprovedDisplayedTimesV11.zip which shows time details.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Rain Forest on August 14, 2014, 07:31:25 AM
Quote from: ahrasis on August 14, 2014, 05:06:47 AM
Uninstall. Use ImprovedDisplayedTimesNoDetailsV11.zip instead. The one you used is ImprovedDisplayedTimesV11.zip which shows time details.
Oh, sorry! Didn't see that one before. Thanks :)
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on August 14, 2014, 09:33:16 AM
That is why I am trying to drop the one with time details. It is a little bit confusing to have them both in there.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Rain Forest on August 14, 2014, 10:14:11 AM
That's ok :)

If you need the Dutch translation:


$txt['itv_years'] = ' jaar geleden';
$txt['itv_months'] = ' maanden geleden';
$txt['itv_weeks'] = ' weken geleden';
$txt['itv_days'] = ' dagen geleden';
$txt['itv_hours'] = ' uren geleden';
$txt['itv_minutes'] = ' minuten geleden';
$txt['itv_year'] = 'Een jaar geleden';
$txt['itv_month'] = 'Een maand geleden';
$txt['itv_week'] = 'Een week geleden';
$txt['itv_day'] = 'Een dag geleden';
$txt['itv_hour'] = 'Een uur geleden';
$txt['itv_minute'] = 'Een minuut geleden';
$txt['itv_second'] = 'Zojuist!';
$txt['improved_times'] = 'Verbeterde tijd weergave';
$txt['on'] = 'Over';
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on August 14, 2014, 10:21:36 AM
Since we got three translations now, I will put all of them with the mod.

Edited: Updated to version 1.1.1 with Spanish_Latin, Dutch & Malay languages added.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Biology Forums on August 25, 2014, 12:20:12 PM
A small tweak request.

Instead of 12 months ago, it gets changed to "A year ago".
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on August 25, 2014, 12:47:54 PM
There aren't suppose to be 12 months ago. ??? The months are called only if they are below 365 days. Divided by 31, they can never be 12 months IMO.

if ($modSettings['todayMod'] == 3 && $itv > 0 && $day_itv > 0)
{
if($day_itv < 2) return $txt['itv_day'];
if($day_itv < 7) return $day_itv . $txt['itv_days'];
if($day_itv < 13) return $txt['itv_week'];
if($day_itv < 31) return ceil($day_itv / 7) . $txt['itv_weeks'];
if($day_itv < 60) return $txt['itv_month'];
if($day_itv < 365) return ceil($day_itv / 31) . $txt['itv_months'];
if($day_itv < 730) return $txt['itv_year'];
if($day_itv > 730) return ceil($day_itv / 365) . $txt['itv_years'];
}


If you need the 12 months, you must change  / 31 to / 30. That will give 5 days extra before it turns to a year. Is that what you want, Shuban?
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Mstcool on August 25, 2014, 01:26:11 PM
Quote from: ahrasis on August 14, 2014, 09:33:16 AM
That is why I am trying to drop the one with time details. It is a little bit confusing to have them both in there.
Quote from: ahrasis on August 14, 2014, 09:33:16 AM
That is why I am trying to drop the one with time details. It is a little bit confusing to have them both in there.

Why don't you so simply put the time details file download link in your post rather than having it on the mod site? :P
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Biology Forums on August 25, 2014, 02:32:59 PM
On my forum is says 12 months ago.

Here's an example

http://biology-forums.com/index.php?board=38.3760

I haven't changed anything.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on August 25, 2014, 04:20:43 PM
I don't get it and I am not sure why. I can see some is already using a year. But I will try to find out why, later.

Quote from: Mstcool on August 25, 2014, 01:26:11 PM
Quote from: ahrasis on August 14, 2014, 09:33:16 AM
That is why I am trying to drop the one with time details. It is a little bit confusing to have them both in there.
Quote from: ahrasis on August 14, 2014, 09:33:16 AM
That is why I am trying to drop the one with time details. It is a little bit confusing to have them both in there.
Why don't you so simply put the time details file download link in your post rather than having it on the mod site? :P

???
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Biology Forums on August 25, 2014, 06:04:32 PM
Thanks...
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Mstcool on August 25, 2014, 08:49:01 PM
In this thread, simply put a download link to the mod (the mod with the times details) and remove the file from the mod site.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on August 26, 2014, 03:28:08 AM
I guess you have to read more then. I dropped the one with time details already but due to the user confusion, I re-uploaded it back. My intention was to remove the one with time details completely. I will implement that again later without any confusing statement. Looking to fix Shuban's 'error' for now.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Mstcool on August 26, 2014, 08:41:48 PM
Quote from: ahrasis on August 26, 2014, 03:28:08 AM
I guess you have to read more then. I dropped the one with time details already but due to the user confusion, I re-uploaded it back. My intention was to remove the one with time details completely. I will implement that again later without any confusing statement. Looking to fix Shuban's 'error' for now.

Oh, I know. I read all of your posts, don't worry lol. But I just meant, if you want to include it then just attach it to your post. p
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on August 26, 2014, 11:56:09 PM
Oh. Now I get your point. Anyway, I will leave it as it is for a while longer.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Biology Forums on October 01, 2014, 02:52:19 AM
I'm finding that this mod if displaying years incorrectly. For example, if someone has signed up for 4 years and 2 months, for instance, it will state 5 years ago. I noticed this because my forum has been alive for four years and two months, and in the admin's profile - the very first member - it states five years ago.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on October 03, 2014, 01:03:56 AM
 Thank you for the feedback Shuban. I will check that out.

Edited: It has been a while after I code this and I have forgotten its cod. But after a thorough check and refreshment, I find that this mod wasn't designed to cover the number of day/s once, it reaches week/s. Similarly to weeks/s and month/s when it reaches month/s and year/s. The mod have to be upgraded to achieve that.

As for your earlier 12 months problem, though I can see it clearly in your forum, I couldn't find a way to fix it yet. I am attending to it as we speak.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Biology Forums on October 03, 2014, 08:55:31 AM
Cool, I'll wait for the update.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on October 03, 2014, 08:58:16 AM
Shuban, this is an attempt to fix the 12 months issue. I have tested this code with no errors but I will need you to test it on your forum. You can start by replacing the current code manually with this in Subs.php file:

// Improved Displayed Times Mod Starts
$itv = $nowtime - $time;
$day_itv = floor($itv / 86400);
if (($then['yday'] == $now['yday'] && $then['year'] == $now['year']) || ($itv > 0 && $day_itv == 0))
{
if ($modSettings['todayMod'] == 3)
{
if($itv < 60) return $txt['itv_second'];
elseif($itv > 60 && $itv < 120) return $txt['itv_minute'];
elseif($itv > 120 && $itv < 3600) return floor($itv / 60) . $txt['itv_minutes'];
elseif($itv > 3600 && $itv < 7200) return $txt['itv_hour'];
elseif($itv > 7200 && $itv < 86400) return floor($itv / 3600) . $txt['itv_hours'];
}
else
{
$itv = $txt['smf10'] . timeformat($logTime, $today_fmt);
return $itv;
}
}
elseif ($modSettings['todayMod'] == 3 && $itv > 0 && $day_itv > 0)
{
if($day_itv < 2) return $txt['itv_day'];
elseif($day_itv > 2 && $day_itv < 7) return $day_itv . $txt['itv_days'];
elseif($day_itv > 6 && $day_itv < 14) return $txt['itv_week'];
elseif($day_itv > 13 && $day_itv < 30) return ceil($day_itv / 7) . $txt['itv_weeks'];
elseif($day_itv > 29 && $day_itv < 60) return $txt['itv_month'];
elseif($day_itv > 59 && $day_itv < 365) return ceil($day_itv / 31) .  $txt['itv_months'];
elseif($day_itv > 364 && $day_itv < 730) return $txt['itv_year'];
elseif($day_itv > 729 && $day_itv > 730) return ceil($day_itv / 365) .  $txt['itv_years'];
}
// Improved Displayed Times Mod Ends


I hope to see it fixes your problem and not creating a new one. Please update here once you have fully tested it. If everything is fine on your side, I will update this mod with the above code.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Biology Forums on October 03, 2014, 09:31:56 AM
The 12 months ago still shows, and the 4 years 5 years issue is still there.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on October 03, 2014, 09:40:58 AM
Ok, now I think I know the problem. Maybe we have to change ceil to floor. Can you try this instead?

// Improved Displayed Times Mod Starts
$itv = $nowtime - $time;
$day_itv = floor($itv / 86400);
if (($then['yday'] == $now['yday'] && $then['year'] == $now['year']) || ($itv > 0 && $day_itv == 0))
{
if ($modSettings['todayMod'] == 3)
{
if($itv < 60) return $txt['itv_second'];
elseif($itv > 60 && $itv < 120) return $txt['itv_minute'];
elseif($itv > 120 && $itv < 3600) return floor($itv / 60) . $txt['itv_minutes'];
elseif($itv > 3600 && $itv < 7200) return $txt['itv_hour'];
elseif($itv > 7200 && $itv < 86400) return floor($itv / 3600) . $txt['itv_hours'];
}
else
{
$itv = $txt['smf10'] . timeformat($logTime, $today_fmt);
return $itv;
}
}
elseif ($modSettings['todayMod'] == 3 && $itv > 0 && $day_itv > 0)
{
if($day_itv < 2) return $txt['itv_day'];
elseif($day_itv > 2 && $day_itv < 7) return $day_itv . $txt['itv_days'];
elseif($day_itv > 6 && $day_itv < 14) return $txt['itv_week'];
elseif($day_itv > 13 && $day_itv < 30) return floor($day_itv / 7) . $txt['itv_weeks'];
elseif($day_itv > 29 && $day_itv < 60) return $txt['itv_month'];
elseif($day_itv > 59 && $day_itv < 365) return floor($day_itv / 31) .  $txt['itv_months'];
elseif($day_itv > 364 && $day_itv < 730) return $txt['itv_year'];
elseif($day_itv > 729 && $day_itv > 730) return floor($day_itv / 365) .  $txt['itv_years'];
}
// Improved Displayed Times Mod Ends
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Biology Forums on October 03, 2014, 09:50:44 AM
Worked :)
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on October 03, 2014, 09:54:42 AM
Ok then. That finalized it. It will be in the coming 1.2.0 version.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on October 03, 2014, 10:27:57 AM
Mod is updated to version 1.2.0. It fixed the issues of time wrongly displayed as reported by Shuban.

I hope more can come to report any failure with regards to this mod and/or my other mods without hesitation.

Thank you all for your continuous support by using this simple mod and/or my other mods.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Biology Forums on October 03, 2014, 10:39:18 AM
Wonderful. Mod of the Month :D
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: DSystem on October 05, 2014, 08:38:51 PM
I Liked. ;)

Brazil Portuguese Translation

<file name="$languagedir/Modifications.portuguese_brazilian.php">
<operation>
<search position="end" />
<add><![CDATA[
$txt['itv_years'] = ' anos atrás';
$txt['itv_months'] = ' meses atrás';
$txt['itv_weeks'] = ' semanas atrás';
$txt['itv_days'] = ' dias atrás';
$txt['itv_hours'] = ' horas atrás';
$txt['itv_minutes'] = ' minutos atrás';
$txt['itv_year'] = 'um ano atrás';
$txt['itv_month'] = 'há um mês';
$txt['itv_week'] = 'uma semana atrás';
$txt['itv_day'] = 'um dia atrás';
$txt['itv_hour'] = 'uma hora atrás';
$txt['itv_minute'] = 'um minuto atrás';
$txt['itv_second'] = 'agora mesmo!';
$txt['improved_times'] = 'Aparições melhoradas';
$txt['on'] = 'sobre';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.portuguese_brazilian-utf8.php">
<operation>
<search position="end" />
<add><![CDATA[
$txt['itv_years'] = ' anos atr&aacute;s';
$txt['itv_months'] = ' meses atr&aacute;s';
$txt['itv_weeks'] = ' semanas atr&aacute;s';
$txt['itv_days'] = ' dias atr&aacute;s';
$txt['itv_hours'] = ' horas atr&aacute;s';
$txt['itv_minutes'] = ' minutos atr&aacute;s';
$txt['itv_year'] = 'um ano atr&aacute;s';
$txt['itv_month'] = 'h&aacute; um m&ecirc;s';
$txt['itv_week'] = 'uma semana atr&aacute;s';
$txt['itv_day'] = 'um dia atr&aacute;s';
$txt['itv_hour'] = 'uma hora atr&aacute;s';
$txt['itv_minute'] = 'um minuto atr&aacute;s';
$txt['itv_second'] = 'agora mesmo!';
$txt['improved_times'] = 'Apari&ccedil;&otilde;es melhoradas';
$txt['on'] = 'sobre';
]]></add>
</operation>
</file>
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: DSystem on October 14, 2014, 09:33:36 PM
Some dates are not changed.

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Ffotos.eletronicabr.com%2Fimage.php%3Fdi%3D6B81&hash=6298b5cbea2c362055ec2d38ee2f8d6ab048d7db)
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: Hj Ahmad Rasyid Hj Ismail on October 17, 2014, 09:40:18 AM
Can I see your Subs.php?
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: DSystem on October 17, 2014, 07:00:03 PM
The file is attached.

Thanks for the attention.
Title: Re: Improved Displayed Times (Relative / Facebook Styles) SMF 2.0.x & 1.1.x
Post by: shayneb on October 18, 2014, 12:26:28 AM
I actually liked it better when it said "on" instead of "about," lol. Can you attach the version that retains the "about" text?
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on October 18, 2014, 12:30:01 AM
Updated

#Change log
@Version 1.2.1
-  Fix reported error for not displaying correct 2nd day thanks to DSystem.
- Added Brazilian language thanks to DSystem.

@shaynab, just change that in the mod language file.
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: shayneb on October 18, 2014, 12:37:37 AM
Quote from: ahrasis on October 18, 2014, 12:30:01 AM
Updated

#Change log
@Version 1.2.1
-  Fix reported error for not displaying correct 2nd day thanks to DSystem.
- Added Brazilian language thanks to DSystem.

@shaynab, just change that in the mod language file.

I actually tried, but wasn't able to find the string. Do you happen to know exactly where it is, and then I will happily change it myself. Thank you for the help!
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on October 18, 2014, 12:40:15 AM
Find $txt['on'] = 'about'; in Modifications.english.php and simply delete it or change it to $txt['on'] = 'on';
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: DSystem on October 18, 2014, 11:16:37 AM
Quote from: ahrasis on October 18, 2014, 12:30:01 AM
Updated

#Change log
@Version 1.2.1
-  Fix reported error for not displaying correct 2nd day thanks to DSystem.
- Added Brazilian language thanks to DSystem.

@shaynab, just change that in the mod language file.

Tested !!! Now works like a charm.  ;)

Thank you so much.
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Rain Forest on October 18, 2014, 11:30:42 AM
Tested and working on my forums! Thanks for the mod :)
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: shayneb on October 19, 2014, 12:31:24 AM
Quote from: ahrasis on October 18, 2014, 12:40:15 AM
Find $txt['on'] = 'about'; in Modifications.english.php and simply delete it or change it to $txt['on'] = 'on';

Worked perfectly, thank you so much.
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Biology Forums on October 19, 2014, 02:53:43 PM
Finding some issues.  ???
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on October 20, 2014, 03:45:15 AM
Interesting. Can you uninstall and try the attached package Shuban? It is tested in 2.0.x version but I haven't got 1.1.x version to test it on.
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Biology Forums on October 20, 2014, 07:14:47 PM
Quote from: ahrasis on October 20, 2014, 03:45:15 AM
Interesting. Can you uninstall and try the attached package Shuban? It is tested in 2.0.x version but I haven't got 1.1.x version to test it on.

Seems to be working, thanks.
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on October 21, 2014, 12:34:14 AM
Thank you for confirming. I will upload that to mod page now.

#Change log
@Version 1.2.2
-  Fix reported error for not displaying correct 2nd/3rd day foor SMF 1.1.x thanks to Shuban.
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Biology Forums on October 29, 2014, 09:13:11 AM
Another issue I found.

1 weeks ago?
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on October 31, 2014, 02:42:01 AM
Thank for your feedback. It must be due to my poor programming ability, shuban. I think I managed to fix this in the updated version 1.2.3.


#Change log
@Version 1.2.3
-  Fix reported error for not displaying correct a week / 1 week, thanks to Shuban.
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Biology Forums on October 31, 2014, 12:07:42 PM
Don't be so hard on yourself... I'll try it out.
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: agentblackhat on January 17, 2015, 08:21:55 AM
I have the Autolock Mod and made a small change so on one of my boards all topics will be locked 30 days after the start date. Will this mod conflict with it?
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on January 17, 2015, 11:35:50 AM
I think it will not be in conflict with that mod.
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: suhaneankit on April 19, 2015, 05:12:31 AM
Nice work..
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on April 19, 2015, 11:47:30 PM
It is just a simple mod that I think is useful but SMF will not implement something like this mod in 2.1 though.
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Ataru Moroboshi on April 20, 2015, 11:34:27 AM
my penny, italian language:


$txt['rltv_years'] = ' anni fa';
$txt['rltv_months'] = ' mesi fa';
$txt['rltv_weeks'] = ' settimane fa';
$txt['rltv_days'] = ' giorni fa';
$txt['rltv_hours'] = ' ore fa';
$txt['rltv_minutes'] = ' minuti fa';
$txt['rltv_year'] = 'un anno fa';
$txt['rltv_month'] = 'un mese fa';
$txt['rltv_week'] = 'una settimana fa';
$txt['rltv_day'] = 'un giorno fa';
$txt['rltv_hour'] = 'un\'ora fa';
$txt['rltv_minute'] = 'un minuto fa';
$txt['rltv_second'] = 'pochi secondi fa';
$txt['rltv'] = 'Orario e Date Relative';
$txt['on'] = 'in proposito';
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on April 21, 2015, 03:19:19 AM
Updated with new translation.

#Change log
@Version 1.2.3.1
-  Adding Italian language support, thanks to Ataru Moroboshi.
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: DSystem on June 12, 2015, 12:36:40 PM
I love this mod. I use since its launch.  ;)

I have some members complaining that they liked more the old-fashioned way.

Would it be possible to put an option in the profile where the Member can choose as the dates of the posts be displayed?
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: DSystem on June 14, 2015, 08:56:50 AM
I did this update.

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Ffotos.eletronicabr.com.br%2Fimages%2F2015%2F06%2F14%2FdisableDRTD.png&hash=74cdc9e68cdeb939d150f0ba2b9b2ccfd9683dcc)

I'm putting here the scripts changed.

Profile.template.php

Before:
<input type="text" name="time_offset" id="time_offset" size="5" maxlength="5" value="', $context['member']['time_offset'], '" class="input_text" /> <a href="javascript:void(0);" onclick="currentDate = new Date(', $context['current_forum_time_js'], '); document.getElementById(\'time_offset\').value = autoDetectTimeOffset(currentDate); return false;">', $txt['timeoffset_autodetect'], '</a><br />', $txt['current_time'], ': <em>', $context['current_forum_time'], '</em>
</dd>


Add after:
                            <dt>
<input type="hidden" name="default_options[rltv_disable]" value="0" />
<label for="rltv_disable"><input type="checkbox" name="default_options[rltv_disable]" id="rltv_disable" value="1"', !empty($context['member']['options']['rltv_disable']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['rltv_disable'], '</label>
</dt>


Modifications.english.php

Add this line:
$txt['rltv_disable'] = 'Disable Relative Time And Date';

Subs.php

Before:
global $context, $user_info, $txt, $modSettings, $smcFunc;

Replace:
global $context, $user_info, $txt, $modSettings, $smcFunc, $options;

Before:
        if ($then['yday'] == $now['yday'] && $then['year'] == $now['year'])
return $txt['today'] . timeformat($log_time, $today_fmt, $offset_type);


Replace:
        if (!empty($options['rltv_disable'])) {
        // Same day of the year, same year.... Today!
        if ($then['yday'] == $now['yday'] && $then['year'] == $now['year'])
return $txt['today'] . timeformat($log_time, $today_fmt, $offset_type);
       } else {

        // Relative Time And Date Mod Starts
$rltv_time = $nowtime - $time;
$rltv_date = floor($rltv_time / 86400);
if (($then['yday'] == $now['yday'] && $then['year'] == $now['year']) ||  ($rltv_time > 0 && $rltv_date == 0))
{
if ($modSettings['todayMod'] == 3)
{
if($rltv_time < 60) return $txt['rltv_second'];
if($rltv_time < 120) return $txt['rltv_minute'];
if($rltv_time < 3600) return floor($rltv_time / 60) . $txt['rltv_minutes'];
if($rltv_time < 7200) return $txt['rltv_hour'];
if($rltv_time < 86400) return floor($rltv_time / 3600) . $txt['rltv_hours'];
}
else
{
$rltv_time = $txt['today'] . timeformat($log_time, $today_fmt, $offset_type);
return $rltv_time;
}
}
if ($modSettings['todayMod'] == 3 && $rltv_time > 0 && $rltv_date > 0)
{
if($rltv_date < 2) return $txt['rltv_day'];
if($rltv_date < 7) return floor($rltv_date) . $txt['rltv_days'];
if($rltv_date < 14) return $txt['rltv_week'];
if($rltv_date < 30) return floor($rltv_date / 7) . $txt['rltv_weeks'];
if($rltv_date < 60) return $txt['rltv_month'];
if($rltv_date < 365) return floor($rltv_date / 31) .  $txt['rltv_months'];
if($rltv_date < 730) return $txt['rltv_year'];
if($rltv_date > 730) return floor($rltv_date / 365) .  $txt['rltv_years'];
} }
// Relative Time And Date Mod Ends


It was perfect. :D
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: Hj Ahmad Rasyid Hj Ismail on June 15, 2015, 03:22:39 AM
Nice one, though I didn't test that. There may be other better way to do that too. :)
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: confuseamuse on July 06, 2017, 05:21:50 AM
Is there a way to have the actual date and time appear when a user hovers over the text?
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: confuseamuse on July 23, 2017, 08:50:53 PM
Quote from: confuseamuse on July 06, 2017, 05:21:50 AM
Is there a way to have the actual date and time appear when a user hovers over the text?

I've referred to this requested feature in this thread (https://www.simplemachines.org/community/index.php?topic=555276.msg3936251#msg3936251) (if anyone was interested).
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: confuseamuse on August 01, 2017, 09:43:48 AM
So I managed to get the tooltip to show. What is the format to get the post date to show? All it does is show the current time (rendering it completely useless). Here's a visual example:

(https://i.imgur.com/2DmY2qv.png)

This date is obviously wrong, so when I activate ReTAD it does this:

(https://i.imgur.com/A6ejk6R.png)


<div class="smalltext"><a href="', $message['href'], '" rel="nofollow" title="',timeformat(time(),'%a %e %b, %Y - %T' , $message['time']), '">', $message['time'], '</a></div>
Title: Re: ReTAD - Relative Time And Date (Facebook Styles)
Post by: confuseamuse on August 05, 2017, 05:43:53 PM
Can someone make an edit of this mod that separates it from the shorthand settings.

I figured out that in order for the tooltip to work, it needs to have a detailed version of the mod working. As a result, this means that I'd manually have to edit the display.template.php and BoardIndex.template.php files and choose where I want the mod to apply itself.

I tried doing this edit, but it just brought a blank page with an error message in the logs. I'm learning the basics of coding for HTML/CSS before getting into PHP/Javascript territory, so I'm not sure how to use the PHP syntax as of now.