[BETA] Simple Dates 0.7.0 (Today/Yesterday/Weeks, Days Ago)

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Kinetix-
Registered User
Posts: 128
Joined: Sun Aug 01, 2004 12:07 pm
Location: Canada
Contact:

[BETA] Simple Dates 0.7.0 (Today/Yesterday/Weeks, Days Ago)

Post by Kinetix- » Tue Sep 07, 2004 4:58 pm

Simple Dates MOD
Current Version: 0.7.0

What is it?
Simple Dates MOD is a... well, a simple MOD that simply changes a single function to make dates in a much simpler format to read. Not that complicated, now, is it? ;)

Doesn't this already exist?
In a way, yes. But the MOD I found that does this had several flaws. One, it was OVERLY complicated. You had to modify a lot for it. Two, it only displayed today/yesterday. Mine displays the following formats:

Today
Today at 12:12 pm
Yesterday
Yesterday at 12:12 pm
2 days ago
3 days ago at 12:12 pm
1 week ago
1 week ago at 12:13 pm
2 weeks ago at 12:13 pm
3 weeks, 2 days ago
3 weeks, 2 days ago at 11:12 pm
etc, etc...



Options:
In the create_date function that you will replace with, you will find this:

Code: Select all

	/**
	 * Important note: Using days limit over 7 will result in the date format 'X weeks, Y days ago'. This
	 * string may be too long in some cases.
	 * CHANGE THIS TO HOWEVER MANY DAYS BACK YOU WANT THIS MOD TO CHANGE TO: today, yesterday, days ago, week ago
	 */
	$days_limit = 7;
	/* END OPTIONS */
User Profile:
The user profile now has an option for a registered user to choose whether or not he would like to see normal dates or simple date formats.

Code: Select all

##############################################################
## MOD Title: Simple Dates MOD
## MOD Author: Kinetix < webmaster@ikrontik.tk > (N/A) http://www.ikrontik.tk
## MOD Description: This MOD will replace certain dates with one of the following formats:
##                  'today', 'yesterday', 'x days ago', 'x weeks ago', 'x weeks, y days ago'.
## MOD Version: 0.7.0
##
## Installation Level: Intermediate
## Installation Time: 5 Minutes
## Files To Edit: 2: langeuage/lang_english/lang_main.php
##                   includes/functions.php
## Included Files: 0
##############################################################
## Author Notes: If you're wondering about the trueness of the dates of this MOD, 
##               by using mktime, this MOD gets the EXACT date that a post was made, not by using
##               the current time - given time to do it.
##               Special note, this MOD will NOT change any dates that are not in the same format as
##               the one set in your CONFIGURATION CONTROL PANEL (such as joined date).
##
##############################################################
## MOD History:  0.5.0 Initial public release.
##               0.5.2 Added $forceeasydate and $notime parameters. See the function comments for details.
##               0.7.0 Added profile option for choosing date format (simple or normal)
##                     Changed date formats for week+day/time to make it easier to translate.
##
Download: Simple Dates MOD 0.7.0

I would very much be interested in those who use the translation feature of create_date. I have no idea whether or not my MOD is fully compatible with it. I would also like translations of this MOD into other languages.


Translations:
French:

Code: Select all

//
// START Simple Dates MOD
// By Kinetix < webmaster@ikrontik.tk >
$lang['Tomorrow'] = 'Demain';
$lang['Tomorrow_at'] = 'Demain à %s';
$lang['Yesterday'] = 'Hier';
$lang['Yesterday_at'] = 'Hier à %s';
$lang['Today'] = 'Aujourd\'hui';
$lang['Today_at'] = 'Aujourd\'hui à %s';
$lang['day_ago'] = '%s jour auparavant';
$lang['day_ago_at'] = '%s jour auparavant à %s';
$lang['days_ago'] = '%s jours auparavant';
$lang['days_ago_at'] = '%s jours auparavant à %s';
$lang['week'] = '%s semaine';
$lang['weeks'] = '%s semaines';
$lang['week_ago'] = '%s semaine auparavant';
$lang['week_ago_at'] = '%s semaine auparavant à %s';
$lang['weeks_ago'] = '%s semaines auparavant';
$lang['weeks_ago_at'] = '%s semaines auparavant %s';
$lang['week_day_ago'] = '%s semaine, %s jour auparavant';
$lang['week_days_ago'] = '%s semaine, %s jours auparavant';
$lang['weeks_day_ago'] = '%s semaines, %s jour auparavant';
$lang['weeks_days_ago'] = '%s semaines, %s jours auparavant';
$lang['week_day_ago_at'] = '%s semaine, %s jour auparavant à %s';
$lang['week_days_ago_at'] = '%s semaine, %s jours auparavant à %s';
$lang['weeks_day_ago_at'] = '%s semaines, %s jour auparavant à %s';
$lang['weeks_days_ago_at'] = '%s semaines, %s jours auparavant à %s';
$lang['Use_simple_dates'] = 'Utilise les dates simples (Hier/Aujourd'hui)
// END New date system
//
Last edited by Kinetix- on Tue Jun 28, 2005 4:36 am, edited 4 times in total.

Shof515
Registered User
Posts: 1169
Joined: Wed Mar 19, 2003 4:36 am

Post by Shof515 » Tue Sep 07, 2004 6:32 pm

i know u want to keep things simple,but is there a way to make so that the user can either have text as a date like Today... or have the real date and time
Whos missing up my sig?

Kinetix-
Registered User
Posts: 128
Joined: Sun Aug 01, 2004 12:07 pm
Location: Canada
Contact:

Post by Kinetix- » Tue Sep 07, 2004 6:45 pm

Updated. Here is a brief explanation of the code:

Code: Select all

// By sending forcestring as true, it will ignore the modification and send the date as $format.
// By sending forceeasydate as TRUE, it will always return an easy date (today, yesterday).
// $notime defaults to whether or not the : character is in the $format, which indicates a time. If you send $notime
//   as true, it will NOT use the time.
//
function create_date($format, $gmepoch, $tz, $forcestring = FALSE, $forceeasydate = FALSE, $notime = FALSE)
The package above has been updated to 0.5.2 and has the new parameters in the function. You only need to replace the 0.5.0 create_date function with the 0.5.2 version of the function to have the new parameters.

Shof515
Registered User
Posts: 1169
Joined: Wed Mar 19, 2003 4:36 am

Post by Shof515 » Tue Sep 07, 2004 7:03 pm

Shof515 wrote: i know u want to keep things simple,but is there a way to make so that the user can either have text as a date like Today... or have the real date and time

did u not see my post?
Whos missing up my sig?

Kinetix-
Registered User
Posts: 128
Joined: Sun Aug 01, 2004 12:07 pm
Location: Canada
Contact:

Post by Kinetix- » Tue Sep 07, 2004 7:06 pm

I added exactly what you asked. If you send the $forceeasydate parameter as TRUE, then it will return "Today".

If you are asking how to make it always return "Today" then you change $forceeasydate = FALSE to $forceeasydate = TRUE in the first line of the create_date function.

Kinetix-
Registered User
Posts: 128
Joined: Sun Aug 01, 2004 12:07 pm
Location: Canada
Contact:

Post by Kinetix- » Tue Sep 07, 2004 7:07 pm

I added exactly what you asked. If you send the $forceeasydate parameter as TRUE, then it will return "Today".

If you are asking how to make it always return "Today" or "Yesterday" then you change $forceeasydate = FALSE to $forceeasydate = TRUE in the first line of the create_date function.


If you are asking how to make it not show the time, then you send $notime as TRUE.

If you want it to never show the time, you you change $notime = FALSE to $notime = TRUE in the first line of the create_date function.


Other than that you will need to be more clear in your post.

Shof515
Registered User
Posts: 1169
Joined: Wed Mar 19, 2003 4:36 am

Post by Shof515 » Tue Sep 07, 2004 7:33 pm

basiclly i want to make it so thats users can change the date from their profile so that they can either have the date or the text
Whos missing up my sig?

User avatar
markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux » Tue Sep 07, 2004 7:51 pm

Yeah, it would be nice if it could be user selectable (adding a new field in their profiles), but also ability to set a board default. Just like other date parameters are handled. Follow?

I was going to translate this to spanish and catalan, but I figured a small inconsistency: $lang['day_ago'] and $lang['day_ago_at'] are redundant, as they are the same as $lang['Yesterday'] and $lang['Yesterday_at']. You should check your code regarding this. 8O :wink:
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)

lover
I've Been Banned!
Posts: 46
Joined: Thu Sep 02, 2004 11:14 pm

Post by lover » Tue Sep 07, 2004 8:03 pm

REally good mod. i hope someone can help you out on this.

Kinetix-
Registered User
Posts: 128
Joined: Sun Aug 01, 2004 12:07 pm
Location: Canada
Contact:

Post by Kinetix- » Tue Sep 07, 2004 8:18 pm

markus_petrux wrote: I was going to translate this to spanish and catalan, but I figured a small inconsistency: $lang['day_ago'] and $lang['day_ago_at'] are redundant, as they are the same as $lang['Yesterday'] and $lang['Yesterday_at']. You should check your code regarding this. 8O :wink:

They are not. They are used for the following:
X weeks, Y days ago
X weeks, Y day ago
X week, Y days ago
X week, Y day ago

Although I guess I could change it to a single format '%d weeks, %d days ago'...
As for the user profile option, I'll get around to adding that in a bit.

User avatar
markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux » Tue Sep 07, 2004 8:30 pm

Kinetix- wrote: Although I guess I could change it to a single format '%d weeks, %d days ago'...

Oppss, sorry. Anyway, I believe this would make it much clearer. Good idea.
Kinetix- wrote: As for the user profile option, I'll get around to adding that in a bit.

Nice! :)

/me watching changes here, i'll post spanish/catalan translations. :)

Keep up the good work. ;)
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)

User avatar
holek
Registered User
Posts: 47
Joined: Sat Aug 09, 2003 11:35 am
Location: Wroclaw, Poland
Contact:

Post by holek » Sun Sep 12, 2004 12:42 pm

This is great :D I love this mod!!! Thanks a lot!!! :mrgreen:

I've created polish language:
http://phpbb.pl/download.php?d=291
Click on Pobierz
P.S. Sorry for my horrible English :(
Messengers: [ Gadu-Gadu: 1658223 ]
My GTA VC Stats

Kinetix-
Registered User
Posts: 128
Joined: Sun Aug 01, 2004 12:07 pm
Location: Canada
Contact:

Post by Kinetix- » Mon Sep 13, 2004 1:28 pm

I have been busy working on some other things this past week, but expect an update to this MOD sometime this weekend.

Kinetix-
Registered User
Posts: 128
Joined: Sun Aug 01, 2004 12:07 pm
Location: Canada
Contact:

Post by Kinetix- » Sat Oct 09, 2004 2:41 pm

Sorry, been gone from the community for a while, but here's an update to the MOD (probably the last, because I think it's done now).

User profile simple dates option has been added! As requested. Also, the date format has been simplified for translation purposes.

The current version has not been tested with EasyMOD!

User avatar
starwiz
Registered User
Posts: 41
Joined: Sun Jan 19, 2003 11:10 pm

Post by starwiz » Sun Dec 12, 2004 6:34 am

I think I found a bug: My server is in California, and my users are located in Florida. I just noticed that after midnight, my index page says "The time now is Yesterday at 12:30 am."

If I increase my GMT offset to +12, it reverts back to "today". The problem seems to be that my server is still in "Yesterday," since it's in Cali...

I'm really tired tonight; I'll look through the code tomorrow and see if I can fix the problem...I thought I'd point it out, though, because you might be able to fix it easier than I.

-Starwiz

Post Reply

Return to “[2.0.x] MODs in Development”

Who is online

Users browsing this forum: No registered users and 14 guests

cron