Switch to german forum

Index > Bug report > Error with date when saving news

Ben
Partner
Avatar
Posts: 2115
Atlanta, Georgia, United States
As some background, I have set my "Date and time format" from System > System maintenance to be "F j, Y | g:i a". When I go to create a news article from Content > News > New article, I get the following error when clicking "Save".

iconCode:
Fatal error: Uncaught exception Exception with message Invalid date format F j, Y | g:i a thrown in /home/account_name/public_html/typolight/system/libraries/Date.php on line 187 
#0 /home/account_name/public_html/typolight/system/libraries/Validator.php(212): Date::getRegexp('F j, Y - g:i a')
#1 /home/account_name/public_html/typolight/system/modules/backend/DataContainer.php(435): Validator->execute('December 26, 20...', 'Date')
#2 /home/account_name/public_html/typolight/system/drivers/DC_Table.php(1318): DataContainer->row()
#3 /home/account_name/public_html/typolight/typolight/main.php(210): DC_Table->edit()
#4 {main}

I imagine this may have something to do with my somewhat modified date format. Maybe TypoLight isn't told to reverse format it to a more standarized style before storing it in the database.
Ben - "I live for live updates."
{follow me on twitter}
{follow TYPOlight on twitter}
27/12/2006 00:24
squidi
User
Avatar
hi ben,

is not a valid date format in typolight ... you can see some examples of valid date and time formats in the "Help Wizard" .... you can only use numeric date and time formats (j, d, m, n, y, Y, g, G, h, H, i, s) ...

F = a full textual representation of a month ( in the example for March )

i don't no why, but i think at the moment you can't use all date() formattings:

iconCode:
date("F j, Y, g:i a");   for this result >    March 10, 2001, 5:16 pm

http://de3.php.net/manual/en/function.date.php
Last edited by squidi, 27/12/2006 00:50
27/12/2006 00:41
Ben
Partner
Avatar
Posts: 2115
Atlanta, Georgia, United States
Yeah ... the news section saves new articles properly now after I went with a simpler date / time format.
Ben - "I live for live updates."
{follow me on twitter}
{follow TYPOlight on twitter}
27/12/2006 08:56
Red Clown
User
Avatar
Ben,

I don't know if you still care about this issue, but it seems that if you change the date format from within your news modules (as opposed to System Settings) you don't get the same error.

My change was simpler than yours (I wanted d-M-y) but I got an error when I tried to change the format globally from System Settings. When I changed it in my news module, it took without an error.
16/04/2007 05:35
spirelli
User
Avatar
Leo, would be great if the date formats for backend and frontend output could be separated somehow, e.g. backend working with numerical dates and Front end can output 'nice' full text months.
16/05/2008 15:08
rachel
User
Avatar
Does anyone know whether any progress has been made on this issue?

I'm building a site with an events system which is going to be used primarily in the US and in France. Presenting the dates in a numeric format is going to be very confusing for our users, because of course Europe puts the day first and the US puts the month first. I really could do with a way to display the month textually.

Anyone got any new or suggestions?
04/02/2009 01:16
rachel
User
Avatar
I'm answering my own question now, for anyone else who may have this problem.

It seems (she says tentatively, having only tested it a little) that as long as the central settings use an approved format, I can safely set each website root (I have two for different languages) to present a textual date format.

It doesn't translate the months, so it's not perfect, but it's still an improvement.
04/02/2009 22:50
Nils Riel
User
Avatar
I've got the same problem, i tried this date format:
iconCode:
l, d. F Y

Normally the ouput should look like this:
iconCode:
Freitag, 1. Mai 2009

I get:
iconCode:
Fatal error: Uncaught exception Exception with message Invalid date format "l, d. F Y" thrown in /var/www/web42/html/bleibartig/system/libraries/Date.php on line 187

#0 /var/www/web42/html/bleibartig/system/modules/formcheck/FormCheck.php(200): Date->getRegexp('l, d. F Y')
#1 /var/www/web42/html/bleibartig/system/modules/frontend/FrontendTemplate.php(125): FormCheck->outputTemplate('output()
#3 /var/www/web42/html/bleibartig/index.php(187): PageRegular->generate(Object(DB_Mysql_Result))
#4 /var/www/web42/html/bleibartig/index.php(288): Index->run()
#5 {main}

I only get the problem if I insert a formular-module :(

After deinstalling the formcheck module, everything works fine
Last edited by Nils Riel, 01/05/2009 18:16
01/05/2009 18:14
nom
User
Avatar
set on settings page

Date format: d.m.Y
Date and time format: l, d. M Y
02/05/2009 23:02
Nils Riel
User
Avatar
That's no real solution in my case, I need the full month-name, not just a short one :)
04/05/2009 19:12
Nils Riel
User
Avatar
Problem still remains. The error is also shown up after saving an catalog item.

l, d. M Y
iconCaution:
Fatal error: Uncaught exception Exception with message Invalid date format "l, d. M Y" thrown in /var/www/web42/html/bleibartig/system/libraries/Date.php on line 187

#0 /var/www/web42/html/bleibartig/system/libraries/Widget.php(558): Date->getRegexp('l, d. M Y')
#1 /var/www/web42/html/bleibartig/system/modules/backend/TextField.php(100): Widget->validator('Donnerstag, 25....')
#2 /var/www/web42/html/bleibartig/system/libraries/Widget.php(420): TextField->validator('Donnerstag, 25....')
#3 /var/www/web42/html/bleibartig/system/modules/backend/DataContainer.php(249): Widget->validate()
#4 /var/www/web42/html/bleibartig/system/drivers/DC_Table.php(1473): DataContainer->row()
#5 /var/www/web42/html/bleibartig/system/modules/backend/Backend.php(208): DC_Table->edit()
#6 /var/www/web42/html/bleibartig/typolight/main.php(99): Backend->getBackendModule('catalog')
#7 /var/www/web42/html/bleibartig/typolight/main.php(287): Main->run()
#8 {main}
Last edited by Nils Riel, 06/05/2009 12:13
06/05/2009 12:13