Module provides additional options for displaying date type fields. You can configure how to show the date for the different values ​​of field.
If the field value
- less than yesterday,
- equally yesterday,
- equally today,
- equally tomorrow,
- ​​greater than tomorrow.
You can choose any format added to the your site - /admin/config/regional/date-time.

Additionally, field return with html classes:
for "today" - <span class="more-dates-today">Value date field with format for today</span>
for "yesterday" - <span class="more-dates-yesterday">Value date field with format for yesterday </span>
and etc.

Example of use: you have a node "Event" and you want to show today's date as format "HH:ii", yesterday - as format "DD MM YY", and tomorrow - as "dd FF YY HH:ii".

Related projects:

(if you have a module that you think is related, submit an issue and I will add it here)


git clone --branch 7.x-1.x http://git.drupal.org/sandbox/mbodalova/2212053.git more_dates

Link to sandbox project.

Comments

MerryHamster’s picture

Issue tags: -date +date format
PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxmbodalova2212053git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

frankbaele’s picture

1) the module does not seem to work with regular date notation or unix timestamp. Check line 123,124 more_date.modules
2) formatter settings can be a extended a bit more
3) the rest of the module seems fine and well written

MerryHamster’s picture

Status: Needs work » Active
MerryHamster’s picture

StatusFileSize
new15.19 KB
new49.39 KB
new32.96 KB
MerryHamster’s picture

Status: Active » Needs review
MerryHamster’s picture

Issue summary: View changes
MerryHamster’s picture

Issue summary: View changes
MerryHamster’s picture

@frankbaele thanks for your comment.
I changed field type.
Now formatter work for 'datetime'.

MerryHamster’s picture

I'm going to do for date and datestamp a little later.

MerryHamster’s picture

Issue summary: View changes
nicorac’s picture

StatusFileSize
new2.28 KB

I had a look at your code and I found some Drupal coding style issues:

more_dates.module:
missing @file file comment

more_dates.module (11):
should read "Implements hook_field_formatter_info()."

more_dates.module (39):
$key variable is not used, so foreach ($date_types as $value) should be used

more_dates.module (109):
useless inline assignment to variable $current_time (not used anywhere)

more_dates.module (141):
bad indentation (4 spaces instead of 2)

more_dates.views.inc (7):
should read "Implements hook_views_data_alter()."

I attached a patch for these.

nicorac’s picture

Status: Needs review » Needs work

You should also add a README.txt file.

MerryHamster’s picture

Issue summary: View changes
MerryHamster’s picture

@nicorac thanks for your comment and patch.
File README.txt added.

MerryHamster’s picture

Status: Needs work » Needs review
MerryHamster’s picture

MerryHamster’s picture

MerryHamster’s picture

Issue summary: View changes
santiwww’s picture

Just a few minor things:
Some typos:
readme.txt (lines 22,27,30)
more_dates.module (line 22)
Not an error but a convention, in module line 145 the CSS class uses a value that could include an underscore instead of a dash.

Anthony Goode’s picture

Hi MerryHamster,

I found some errors reported by automated review tools of http://pareview.sh.

All in the file more_dates_views_handler_field_date.inc.

This is a minor question, is the more_dates_format_nice_view a helper function?, If so neither an error but another convention, it is recommended that its parameters are documented.

I agree with the previous comment #3 of frankbaele, the rest of the module seems fine and well written.

vtkachenko’s picture

Currently I found some issues. One of them is realy bug. Other are really minor.

1. In function more_dates_format_nice_view you use definition sign "=" instead of equal sign "==" :

- elseif ($value_cleaned = strtotime('-1 day', $now_cleaned)) {
+ elseif ($value_cleaned == strtotime('-1 day', $now_cleaned)) {
    $format = 'yesterday';
  }
- elseif ($value_cleaned = strtotime('+1 day', $now_cleaned)) {
+ elseif ($value_cleaned == strtotime('+1 day', $now_cleaned)) {
    $format = 'tomorrow';
  }

2. In function more_dates_views_data_alter you can pass 'title' through "t" function:

-'title' => $field_info['title'] . ' more_dates',
+'title' => t('@label more_dates', array('@label' => $field_info['title'])),

3. Some typo in file README.txt :

Comma is missed:

Only five settings:
- less than yesterday,
- equally yesterday,
- equally today
- equally tomorrow
- greater than tomorrow.

"date puplish" instead of "date publish".

"bithday" instead of "birthday".

Good luck.

MerryHamster’s picture

Hello.
Thank you for your commits. Added changes.

MerryHamster’s picture

Issue summary: View changes
subhojit777’s picture

Status: Needs review » Needs work

Found some pareview issues: http://pareview.sh/pareview/httpgitdrupalorgsandboxmbodalova2212053

Though english is not my native language, but you need to fix certain help text, they seem confusing. For example, The date format which will be used for field value until than day ago., it should show "Format for dates before yesterday". For today's date, "Format for today's date." It should be kept as simple as possible, and also considering the proper meaning at the same time.

Found some issues. I tested the settings with date (unix timestamp) field and it was not working. However it worked for date field. You need to make sure it works for all date type fields.

Instead of '<span class="more-dates-' . $format . '">' . format_date($value, $config[$format]) . '</span>', you should use theme_html_tag(), this way you will follow Drupal standards for writing HTML.

Did a manual review and your code seems ok.

I have not used custom formatters module before, but I guess we can do the same (as your module does) in custom formatters. Even if it does not provides as good features as your module, but you should consider making this module more flexible, like I want to show medium date format for dates those are five days before current date.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.