The date handlers that come with Views (eg for node creation date) allow the entering of a custom format in the handler's options.

This does not seem possible with Date module's handlers.

One advantage of doing this is that it can be baked into a Feature along with that view, whereas (AFAICT) date formats are site configuration that can't be exported.

Comments

calefilm’s picture

I think this is related... I see "Formatter" within the Date field... I would like to select just "Date" not "Date and Time"

Because I did go to my date settings and added a special format. Only to read 'Tue May 15'

But if a user selects a date for an event, say: 'May 15 - 7:00AM" I need to group the Event Dates by Days like Craigslist does: Tue May 15

But within views, if I choose DATE to be the Group, it won't allow me to group dates by Day: Tue May 15
Instead, the views group each event date by Time, i.e. 'Tue May 15 7:00AM'

....which ruins my view

ezra-g’s picture

Issue tags: +commonslove

This would be helpful for the Commons distribution as part of #1797490: Implement Featured content block to spec.

Adding the "commonslove" tag.

iztok’s picture

Why do I have a feeling this was already possible in Views at some point? Confused very much!

pixelsweatshop’s picture

Why do I have a feeling this was already possible in Views at some point? Confused very much!

It is for things such as posted/updated dates, but not for date fields provided by the date module.

seanb’s picture

Attached is a patch that should fix this.

seanb’s picture

Status: Active » Needs review
nagy.balint’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for this.

Because of the inability to properly put the date formats into features, this patch is badly needed in this module.

Seems to work fine.

johnpitcairn’s picture

Applies cleanly here, works well.

Status: Reviewed & tested by the community » Needs work
seanb’s picture

Weird error:
FAILED: [[SimpleTest]]: [MySQL] Repository checkout: failed to checkout from [git://git.drupal.org/project/migrate.git].

Is this RTBC?

nagy.balint’s picture

Was 6 months ago :)

seanb’s picture

Status: Needs work » Reviewed & tested by the community

Let me just put it back.. Thnx!

steinmb’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.95 KB

Patch format not right. Unable to apply this with git.

git apply -v date-allow_entering_of_custom_date_format_in_views_field_handlers-1504202-5.patch
Checking patch date.module...
error: while searching for:
      return 'date_plain';
      break;
    default:
      $format = date_format_type_format($format_type, $langcode);
      break;
  }

Attaching a re-rolled patch.

seanb’s picture

Awesome, thnx!

hamrant’s picture

Version: 7.x-2.x-dev » 7.x-2.8
Assigned: Unassigned » hamrant
Status: Needs review » Closed (fixed)
Issue tags: -commonslove +dcuacs2015

This functionality is included in the module, tested on the 7.x-2.8 version.

krlucas’s picture

Assigned: hamrant » Unassigned
Status: Closed (fixed) » Reviewed & tested by the community

Not sure what @hamrant is referring to but this feature does not exist in Date yet. He was probably testing with core date properties (created/updated), not user created Field API + Date fields.

The patch in #14 still applies to 7.x-2.x-dev. This provides a really helpful alternative to the rigamarole of creating custom date formats and is more consistent with how Views treats core dates. Marking as RTBC.

steinmb’s picture

Version: 7.x-2.8 » 7.x-2.x-dev
puudutus’s picture

I can confirm patch #14 worked. I used it in the latest dev version. This would be a really nice feature in the main module.

acrollet’s picture

+1 for committing, #14 applies and works

Teeman’s picture

#14 worked beautifully, thanks.

attheshow’s picture

Patch #14 works for me too.

  • podarok committed 2b79011 on 7.x-2.x authored by steinmb
    Issue #1504202 by seanB, steinmb: Allow entering of custom date format...
podarok’s picture

Status: Reviewed & tested by the community » Fixed

#14 is merged. Thanks

Status: Fixed » Closed (fixed)

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