Problem/Motivation

The output of the calendar title always falls back on the default of the get_variable() call, settings of admin/config/regional/date-time/date-views cannot be used.

Proposed resolution

The keys of the variable's for date formats with- and without year are dynamically concatenated. There seems to be an underscore missing.

CommentFileSizeAuthor
#70 date-title_date_formats-2294973-70.patch1.4 KBladybug_3777
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch date-title_date_formats-2294973-70.patch. Unable to apply patch. See the log in the details link for more information. View
#54 date_views-month_with_year.patch637 bytesPascalAnimateur
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch date_views-month_with_year.patch. Unable to apply patch. See the log in the details link for more information. View
#14 theme.txt7.72 KBlsabug
#7 title_date_formats-2294973-6.patch880 bytesmicahw156
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch title_date_formats-2294973-6.patch. Unable to apply patch. See the log in the details link for more information. View
#1 title_date_formats-2294973.patch1004 byteskeesje
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch title_date_formats-2294973.patch. Unable to apply patch. See the log in the details link for more information. View
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

keesje’s picture

FileSize
1004 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch title_date_formats-2294973.patch. Unable to apply patch. See the log in the details link for more information. View
keesje’s picture

Issue summary: View changes
micahw156’s picture

micahw156’s picture

Status: Active » Reviewed & tested by the community

I concur, this patch solves the problem with date views not getting the correct title.

silurius’s picture

I applied the above patch to date-7.x-2.x-dev (2014-Jul-29), cleared caches and the issue remains.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 1: title_date_formats-2294973.patch, failed testing.

micahw156’s picture

Status: Needs work » Needs review
FileSize
880 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch title_date_formats-2294973-6.patch. Unable to apply patch. See the log in the details link for more information. View

Rerolled keesje's original patch with correct file paths.

micahw156’s picture

@silurius:

Are you sure the patch applied cleanly? Can you re-test with the new patch?

Also, the original #355058: Hardcoded day/month/week output format for theme_date_nav_title() patch added a new admin/config/regional/date-time/date-views admin form, but it did not contain an update script to populate default values where date_views was already installed. Try opening that form and saving (so the default values actually get stored in the variables table) before you test again.

silurius’s picture

That last step (re-saving Date and time) did the trick. Thank you so much! I was really pulling my hair out over this one.

vijaycs85’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the patch and testing. Looks good to me.

dhalbert’s picture

I updated to the latest Date 7.x-2.x, applied the #7 patch, and I still saw "July 1, 2014" in the month view. I tried going to admin/config/regional/date-time/date-views as mentioned in #8, but strangely I get "You are not authorized to access that page", even though I'm logged in as Administrator

dhalbert’s picture

I fixed this manually to get around the authorization problem I had in #2294973-11: Date format in calendar title remains default (e.g., month view date shows as July 1, 2014) (which I still have). date_views.install sets some variables, but did not get run on update. I did the equivalent of that code from drush:

drush vset date_views_month_format_with_year 'F Y'
drush vset date_views_month_format_without_year 'F'
drush vset date_views_day_format_with_year 'l, F j, Y'
drush vset date_views_day_format_without_year  'l, F j'
drush vset date_views_week_format_with_year  'F j, Y'
drush vset date_views_week_format_without_year 'F j'
bezu60’s picture

Can anyone instruct a less technical site manager on how to fix this. I don't use drush and I don't know how to apply the patch. Very frustrated! Will there be an update eventually that fixes this issue?

lsabug’s picture

FileSize
7.72 KB

I also have this issue after the security update. The #7 patch fixed it.

@bezu60 - I've attached patched theme.inc file - change extension .txt to .inc

Immansophia’s picture

I have created an issue separately at https://www.drupal.org/node/2313269. Sorry about that, I am not a regular user at Drupal.org.

Immansophia’s picture

Isabug, I tried updating the theme.inc file, but to no avail. The issue still remains. Anyone, please help!

bezu60’s picture

@isabug - I don't know how to apply this. Do I simply replace the file in CPanel?

bezu60’s picture

Is this the file to replace?

public_html/sites/all/modules/date/date_views/theme

Immansophia’s picture

Author of the Date Module: Please review the conversation thread and post updates.

micahw156’s picture

Quick workaround for people unable to apply the patch:

STEP 1: Edit date_views/theme/theme.inc and go find line 165.

Change these two lines:

$format_with_year = variable_get('date_views_' . $granularity . 'format_with_year', 'l, F j, Y');
$format_without_year = variable_get('date_views_' . $granularity . 'format_without_year', 'l, F j');

To these two lines:

$format_with_year = variable_get('date_views_' . $granularity . '_format_with_year', 'l, F j, Y');
$format_without_year = variable_get('date_views_' . $granularity . '_format_without_year', 'l, F j');

Note: the only difference is one underscore character added to each line.

Upload the changed file back to your web server.

STEP 2: Go to (YOUR_WEBSITE)/admin/config/regional/date-time/date-views and click Save. If you get permissions errors, try clearing caches.

  • vijaycs85 committed aff5e58 on 7.x-2.x
    Issue #2294973 by lsabug, micahw156, keesje: Fixed Date format in...
vijaycs85’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all. Created 2.9-alpha1 with this fix.

Immansophia’s picture

vijaycs85: Is there a link to this fix? I am not able to find it in the Drupal site.

bezu60’s picture

I think it will be up shortly and if you wait a few hours it will hopefully appear as an automatic recommended update. I'm just happy I don't have to deal with a patch!

vijaycs85’s picture

silurius’s picture

Strangely, 7.x-2.8 (as of this morning) doesn't appear to have received this patch, and yet after upgrading to it without patching it, my titles are still correct (month only). Maybe clicking save on /admin/config/regional/date-time/date-views alone is a good enough fix in some cases?

bezu60’s picture

@silirius... I don't think so...did not work for me.

vijaycs85’s picture

Just FYI, As per https://www.drupal.org/node/128614 I made an alpha release (7.x-2.9-alpha1). So it won't be appear in Date module home page (or on your site's update page) until next major release (i.e. 7.x-2.9). Need to manually update, if you want this fix immediately.

bezu60’s picture

I just did it and it worked perfectly! Thanks Vijaya! And don't forget everyone...after you install the updated module you need to go to /admin/config/regional/date-time/date-views and "Save". You don't have to change anything... just click save.

BWPanda’s picture

Note: those people experiencing permission issues accessing /admin/config/regional/date-time/date-views might need to apply the patch from #2313587: Incorrect permission name.

dhalbert’s picture

Title: Date format in calendar title remains default » Date format in calendar title remains default (e.g., month view date shows as July 1, 2014)

Clarified issue title - getting a number of duplicates.

Immansophia’s picture

Hello Vijaycs85, the alpha release also did not work for me. I am still seeing the day name, date, month and year. Somehow this bug remains. Any thoughts?

Immansophia’s picture

Hello All, it worked. Actually I was updating the incorrect date settings. Thanks to vijaycs85 for this patch and to all who provided valuable input.

pjbarry21’s picture

Latest dev (dated July 31) worked for me, too. I did run update.php (and I don't have any CSS/javascript aggregation set, yet as these are brand new site installations -- so I didn't need to clear any of the caches as an additional step -- but maybe update.php does that as part of its process). I had already hit save (in #29) BEFORE installing this latest dev (it was something I tried before I started my search for a fix) -- it didn't fix my issue with 7.28, but as soon as I installed the latest dev (dated July 31), everything looked perfect.

Gib...’s picture

Hi,
I confirm that to fix this problem I had to :

  • install Date 7.x-2.9-alpha1
  • remove the extra space in date_views.module as propose by BWPanda #30. I modified only this line :
    'access arguments' => array('administer site configuration '), removing the space after "configuration"
  • of course upload date_views.module to the server
  • clear all cache to access admin/config/regional/date-time/date-views (which I saw for the first time)
  • save that form.

Thanks all.

ryanoreilly’s picture

Confirming #7 applied to 7.x-2.8 also fixed the issue for me. My "page by date" title was also displaying incorrectly.

Miao1994’s picture

#20 works perfectly for me. Drupal 7.30, Date 7.x-2.8.

Thanks

DebMorris’s picture

#20 fixed the issue for me as well (Drupal 7.31, Date 7.x-2.8)

hwasem’s picture

I applied the patch in #7 and cleared caches. I was finally able to see the page at /admin/config/regional/date-time/date-views. I saved it and the month/year was showing correctly on my monthly calendar again.

savingstrangers’s picture

Comment #20 resolved this issue for me, thank you!

hass’s picture

Is this the ONLY change that exists between 2.8 and in 2.9-alpha1?

susoson’s picture

Comment #20 hack worked for me as well.

Core 7.31 Calendar 7.x-3.4 Date 7.x-2.8

_Arjan_’s picture

#20 works just fine. It's a simple solution, should be fixed in the next release.

bneil’s picture

I've submitted an issue and patch to add an update hook in #2332181: Add update hook for date_views variables which sets the variables so you don't have to go and save the form manually.

rbrownell’s picture

#20 Worked for me. Thanks for posting this!

miniwebs2’s picture

#20 worked for me also - thankyou!

tzt20’s picture

@vijaycs85 Any chance that you could add the permission name fix to 2.9 alpha as well (https://www.drupal.org/node/2313587)? It's been applied to 7.x-2.x, but that code isn't quite ready for use yet (https://www.drupal.org/node/1075880). I'm also getting access denied as an administrator when trying to visit /admin/config/regional/date-time/date-views.

vijaycs85’s picture

@tracyt10, sure we can have another alpha release with current fixes.

tzt20’s picture

Thanks vijaycs85! I look forward to the release!

vijaycs85’s picture

7.x-2.9-alpha2 is out - Checkout https://www.drupal.org/node/2344525

bigdogsam’s picture

Thanks for all you do, alpha2 worked like a champ!
Great job

hopfrog’s picture

For me it doesn't work

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

PascalAnimateur’s picture

FileSize
637 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch date_views-month_with_year.patch. Unable to apply patch. See the log in the details link for more information. View

The patch from #7 works like a charm, but I think the mini calendar should include the year in its title (F Y).

Here's a patch that fixes this.

hopfrog’s picture

It's work. Thanks

SebaZ’s picture

It's not fixed. It should be reworked. Last update (at 2014-Nov-02) hides Date Views tab and implements 3 bugs in code.

Can someone make this changes as one patch?

File: date_views/date_views.module

 'access arguments' => array('administer site configuration '), // <- here is space, blank sign which is blocking Date Views Tab
 'access arguments' => array('administer site configuration'),

File: date_views/theme/theme.inc this is patch #1

 $format_with_year = variable_get('date_views_' . $granularity . 'format_with_year', 'l, F j, Y'); // <-bug
 $format_without_year = variable_get('date_views_' . $granularity . 'format_without_year', 'l, F j'); // <-bug
 $format_with_year = variable_get('date_views_' . $granularity . '_format_with_year', 'l, F j, Y');
 $format_without_year = variable_get('date_views_' . $granularity . '_format_without_year', 'l, F j');
SebaZ’s picture

Priority: Normal » Critical
Status: Closed (fixed) » Needs work
Issue tags: +stable dev
schifazl’s picture

I hadn't time to create a patch with SebaZ suggestions, but I can confirm that #56 works

BlaF’s picture

Bugs found by SebaZ are already fixed in git repository:
- missing underscores in format_with/without_year was pushed July 31st by vijaycs85 (commit aff5e58 for this issue, see #21)
- typo in format arguments was fixed September 16th by bwpanda with commit 784680a for issue #2313587

7.x-2.9-alpha2 has both fixes.

drupalerocant’s picture

I tried 7.x-2.9-alpha2 and it didn't work for me.
Also 7.x-2.9-beta1 same problem.
I checked that bugs found by SebaZ are already fixed as BlaF said.
Any help on what is happening??
i am using drupal 7.33 in case it is related.
Thanks!

Lostboy22’s picture

Your still must go to: admin/config/regional/date-time/date-views
(Administration»Configuration»Regional and language»Date and time Date-View tab)
and click "Save Changes" even if you don't change anything.

drupalerocant’s picture

Thank you very much Lostboy!
It finally worked in two of my websites!

jasonkryst’s picture

I can also confirm that the response within comments #59 and #61 fix the issue at hand. It would be nice if we could have the settings auto-applied, skipping #61.

Any thoughts?

davidkp’s picture

Awesome... #56 and #61 did the trick. Thanks!

Didier Misson’s picture

#56 and #61 did the trick for the Month view.

But not ok for the week vue.

In French : "Semaine du Décembre 1, 2014" : not correct.
It must be "Semaine du 1 Décembre 2014"

I hope it will be corrected in the next "date" update.
Thanks.

BlaF’s picture

@Didier Misson, no need to wait for the next date update: in admin/config/regional/date-time/date-views, set "Date views week format with year" to "j F Y" and "Date views week format without year" to "j F" and the date will use French date format.

Didier Misson’s picture

@BlaF : ok, I will make this.
You are right : no need to wait the next date update
;-)
Thanks.

mtprell’s picture

Does anybody have an alternative solution to patching or directly editing theme.inc? For various reasons, this is not an option.

Michelle’s picture

I just updated to 7.x-2.9-beta2 and it fixed the problem for me. Going to leave the status alone but, if someone else can confirm, this seems to be fixed.

Edit: While it fixed the problem, now the paging arrows on either side of the month no longer work so beware if you are updating to fix this problem.

Edit #2: This patch fixes that problem: https://www.drupal.org/node/2372073#comment-9337149

ladybug_3777’s picture

FileSize
1.4 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch date-title_date_formats-2294973-70.patch. Unable to apply patch. See the log in the details link for more information. View

Per request here is a patch file (for date version 2.8) that does what is in #56. After applying be sure to follow the instructions on #61.

#61
Lostboy22:
Your still must go to: admin/config/regional/date-time/date-views
(Administration»Configuration»Regional and language»Date and time Date-View tab)
and click "Save Changes" even if you don't change anything.

NOTE!!!!: This patch will likely fail simple test because it is not written against the dev version (which this issue is filed against), but it does work as expected with the current 2.8 version and will get you through until the new date version is released. Plus it will keep you from having to manually apply the changes and it also makes rollback a lot easier.

happysnowmantech’s picture

@ladybug_3777: Thank you, your patch in #70 worked for me!

akalata’s picture

Status: Needs work » Needs review

The last submitted patch, 54: date_views-month_with_year.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 70: date-title_date_formats-2294973-70.patch, failed testing.

ladybug_3777’s picture

^^ As suspected my patch did fail simple test, but that is because these changes already exist in the dev version of the module. The patch itself is still OK to use on version 2.8

hass’s picture

Priority: Critical » Normal
Status: Needs work » Closed (fixed)
leistiko_texvet’s picture

FWIW: I manually updated to 7.x-2.x-dev tar.gz (posted 2014-Dec-07) and it resolved the situation for me. It's worth noting that the title of my calendar instances just shows the month now, but that's better than erroneously showing the date as the first of the current month. Future readers who are confused about how to manually update should check out https://www.drupal.org/node/250790#replace

Keith Caulkins’s picture

Upgrading to 7.x-2.x-dev worked for me as well. I did have to go to admin/config/regional/date-time/date-views however, and click save.

Jen7’s picture

#56 worked for me. Many, many thank yous, SebaZ.

Funksmaname’s picture

This is still an issue - update to 7.x-2.x-dev fixed it.

TajinderSingh’s picture

#56 worked and correct solution.

The last submitted patch, 7: title_date_formats-2294973-6.patch, failed testing.

sirian’s picture

#56 WORKED FOR ME, together with #61
Thank you Sebaz and Lostboy22

idea_vasil’s picture

Tnx @micahw156 #20 worked for me too

.bert’s picture

Thanks @ladybug_3777

Patch in #70 works great on v2.8 if you need to get by until the next stable version.

PascalAnimateur’s picture

Is it possible to make the date_views settings multilingual through the use of i18n_variable? This would allow specific date_views formats for different languages instead of unique, global settings.

pcrats33’s picture

Comment #20 is on key. I just patched Date 2.8 because it needed an extra underscore:
date/date_views/theme/theme.inc

function theme_date_nav_title($params) {
...
lines 168, 169:
  $format_with_year = variable_get('date_views_' . $granularity . '_format_with_year', 'l, F j, Y');
  $format_without_year = variable_get('date_views_' . $granularity . '_format_without_year', 'l, F j');

The emphasis is on the change from ... $granularity . 'format_with_year ...
To this: ... $granularity . '_format_with_year ...

Also in date_views.install, these drupal variables are set. If you never installed date and just upgraded from a previous version, you may need to set all these variables again. You can either reinstall the date module, or just set the variables some other way programmatically one time.

Now my calendar is showing February in the title, not Sunday, February 1!

jayhawkfan75’s picture

The workaround provided on #20 worked great for me. Thanks micahw156! However I did start getting these warnings in my logs afterwards when users visit a simple view for our news page that displays an unformatted list of 10 teasers per page:

Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 384 of sites\all\modules\date\date_api\date_api.module).

Could they be related? Has anyone else noticed this issue?

liquidcms’s picture

not sure why this is marked as closed as i don't think it is fixed in any stable release, is it?

i had 2.9-beta but it didn't work for other reasons and i see not listed on project page anymore; so reverted to 2.8 (odd thing is the changes from #70 appear to be in place already). i go to format config page and save.

problem persists.

ladybug_3777’s picture

It is not fixed in a stable release, it's fixed in the dev version. If you want to fix your current stable release you can use the patch provided in #70.

debain’s picture

You can use the _init hook in your module:

function hook_init() {
	variable_set('date_views_monthformat_without_year', 'F'); //Month only
}
jayhawkfan75’s picture

@ladybug_3777: Patch #70 worked for me as well. Thanks! However I immediately started seeing these new php warnings in my logs each time an unrelated view gets loaded:

Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 384 of sites\all\modules\date\date_api\date_api.module).

Which references this line:

return parent::format($force ? $format : date_limit_format($format, $this->granularity));

of

* @return string|false
   *   Returns the formatted date string on success or FALSE on failure.
   */
  public function format($format, $force = FALSE) {
    return parent::format($force ? $format : date_limit_format($format, $this->granularity));
  }

Do you think that it could be related to the patch? Do you have any suggestions?

ladybug_3777’s picture

jayhawkfan75, after applying the patch did you also do this part:

Your still must go to: admin/config/regional/date-time/date-views
(Administration»Configuration»Regional and language»Date and time Date-View tab)
and click "Save Changes" even if you don't change anything.

If not that's probably all that's wrong.

jayhawkfan75’s picture

Yes I did do that step and I cleared the cache as well. It did fix the original issue and then I started seeing those warnings in the logs. It could be unrelated (especially since no one else has reported it), but I thought that the timing was interesting. The warnings don't crash the site, but they do appear four times each time the view is loaded.

veverita’s picture

I applied #20 to the file found in panopoly-7.x-1.19 and it fixed the problem.
Thanks

jayhawkfan75’s picture

@ladybug_3777: Another user created an issue report Error with DateTime::format() for these warnings that I'm now receiving, so I'll continue there. Thanks for your help.

maletruv’s picture

#56 worked for me. Thanks

pgdagenais’s picture

Is it possible for me to do #61 in a multi-site installation with drush ?

Edit: Updated to 2.9-rc1 and I don't have this problem anymore.

jackalope’s picture

Thanks for the patch in #70, @ladybug_3777! Works well for me.

The last submitted patch, 7: title_date_formats-2294973-6.patch, failed testing.

Steve -cc’s picture

Having this problem on installation using 7.x-2.8. Went to apply patch at #56 but cant find the two files - date_views/date_views.module
and
date_views/theme/theme.inc to do them manually
Do these patches apply to 7.x-2.8?
If so can someone point me to where the files should be?
Thanks
Steve

Steve -cc’s picture

Status: Closed (fixed) » Needs work
jayhawkfan75’s picture

@Steve -cc: They should be located at:

sites/all/modules/date/date_views/date_views.module
sites/all/modules/date/date_views/date_views/theme/theme.inc

Do you not see them there?

Steve -cc’s picture

No - not there sub directories run from date to date-tools, then help. No date_views in the directory.

jayhawkfan75’s picture

Hmm, that's strange. I'm not sure why you don't have those in your install, so you'll want to try a clean install of 7.x-2.8 with all of its sub-directories including date_views and go from there.

Steve -cc’s picture

Thanks for the feedback. The installation was missing the directory. Reinstalled - added the patches at #56 - re saved config as in #61. Fixed

Steve -cc’s picture

Status: Needs work » Closed (fixed)
jayhawkfan75’s picture

@Steve -cc: That's great news. Glad to help.

cdmo’s picture

#20 worked for me. Just a couple underscores missing. Seems like this should be able to be patched into the production branch, without too much trouble right?

ladybug_3777’s picture

@cdmo there is a patch at comment #70 (created from the manual patch instructions from item #56) that you can apply to version 2.8 if needed.

cdmo’s picture

Thanks @ladybug_3777. I did have the fix in place, I was just wondering why it couldn't be committed to the production branch of the module.

And... now I see that the missing underscores have been added in the latest version of Date, version 2.9, which was rolled out a couple days ago. Looks like my petty griping occurred only a short time after the fix was released :) Thanks to all who maintain the Date suite of modules!

klidifia’s picture

Solution: update the date module. Works in 2.9.