The value should be set to "small" as shown below =>

" $type The format to use. Can be "small", "medium" or "large" for the preconfigured date formats. If "custom" is specified, then $format is required as well."

Above taken from Drupal API.

But even when set to small, the year is somehow omitted and upload fails.

Any chance for a fix.

Thanks
Stephen

CommentFileSizeAuthor
#2 311422_format_date_small.patch2.43 KBgreggles

Comments

spjsche’s picture

Priority: Normal » Critical

I have changed the Priority status to "critical".

greggles’s picture

Status: Active » Needs review
StatusFileSize
new2.43 KB

A patch would move this forward faster than setting it to critical.

How does this patch look?

spjsche’s picture

I do apologise, I thought only the maintainers are allowed to implement patches and review any code concerned.

But thank you for the advice, and I will do so in the future.

Oh and I will implement your patch and test it.

Thanks
Stephen

greggles’s picture

@spjsche - thanks for testing this. Here are some book pages about finding/fixing bugs in Drupal:

Patches - http://drupal.org/patch
Getting bugs fixed/good issue reports: http://drupal.org/node/73178

spjsche’s picture

Thanks for the excellent pointers, and apologies again.

Regards
Stephen

spjsche’s picture

I have implemented the patch, but when I use the "Token" values of "[yyyy]/[mm]/[dd]" to use with
the "Filefield" CCK module I now get a directory structure of "yyyy/mm/dd" and not "2008/10/16" as I had hoped.

I will investigate further.

Thanks
Stephen

spjsche’s picture

The use of [site-date] should resolve to a file structure of (in my case UK date format) "17/10/2008".
But the result is only "17/10" the year is missing

The functions only work in the "Public" upload mode and not "Private" but that is something else, I will investigate further and determine if the issue is with the "Token" module.

Thanks
Stephen

spjsche’s picture

I have changed the token.module as follows =>

- $values['site-date'] = format_date(time(), 'small', '', variable_get('date_default_timezone', 0));
+ $values['site-date'] = format_date(time(), 'custom', 'Y/m/d', variable_get('date_default_timezone', 0));

and everything works a treat both in the "Public" and "Private" upload methods.
I will try and figure out the why it works when I install some debugging tools on my laptop.

Thanks
Stephen

dave reid’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #2 looks great.

dave reid’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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