Comments (16)
The first is a Date/Time issue, not core. However, I have made a change to the General::createXMLDateObject
to accept a Date and Time format. What this means is the the output can be given the Symphony Date constants (which are read from your config) to get the result you desire.
I don't want to push the Date field to use these constants in 2.2.2 as potentially it will break sites that are relying on the current functionality. There is also the very real possibility that your configuration settings work well for the frontend, but not the backend. Consider this example, my testing build uses H:i a
for time, which makes 2:00 pm
. If the Date field used this on the frontend, it becomes a pain in the ass to incorporate with XSLT. So we might change it so H:i
, (which is the current default), but now the backend loses a bit of niceness for the sake of the XSLT.
We should put this on the radar with #693, where we have already started some discussion about different output formats.
Now for the second part, I think this is also related to Date formats, but I not sure how you made the connection with Line 135?
/cc @nilshoerrmann
from symphonycms.
I responded on the forum regarding the first part. I actually don't understand your problem.
Regarding the second issue: what's your PHP version. This should not happen with PHP 5.3+. If it does, this is a PHP issue.
from symphonycms.
I'm using PHP 5.3.2.
If I use any other date format than d/m/Y
it works fine, like Y/m/d
, it's only happening when I use my desired d/m/Y
, which coincidentally is standard British date format.
I narrowed it down to line 135
by trying a date that would break if the day and month were switched, like 23/10/2011
, as 10/23/2011
would fail being formatted with d/m/Y
.
I'm sorry to disagree with you on this, but this is a bug. DateTimeObj should be able to accept any formatted date. I can understand why it is stored in the DB and therefore the XML as an Americanised date, that is clear to me after some sleep, but swapping the day and month around? That's just wrong.
from symphonycms.
Symphony parses dates using the system date format, see line 116. Line 135 will only be used it the given date could not be parsed using the system date format.
Does your PHP version include DateTime::createFromFormat()
(it should if you are on 5.3+).
from symphonycms.
I wouldn't know. How do I find out?
It definitely gets to that line using d/m/Y
as the date format.
from symphonycms.
If you add this after line 116, what's the result?
echo __SYM_DATETIME_FORMAT__ . ' / ' . $string;
vardump($date);
die();
from symphonycms.
By the way shouldn't you celebrate something and not debug Symphony :)
from symphonycms.
Hmmm...
d/m/Y H:i / 02/07/2011
boolean false
from symphonycms.
Try replacing line 116 with this:
$date = DateTime::createFromFormat(__SYM_DATETIME_FORMAT__, $string);
if($date === false) {
$date = DateTime::createFromFormat(__SYM_DATE_FORMAT__, $string);
}
from symphonycms.
The output from that using your post earlier is
d/m/Y / 02/07/2011
object(DateTime)[83]
public 'date' => string '2011-07-02 10:25:00' (length=19)
public 'timezone_type' => int 3
public 'timezone' => string 'Europe/London' (length=13)
Now that's better ;o) That works fine. I don't know what the implications for this are...
from symphonycms.
Taking out the dump also allows that to save correctly, with both the Date Time field ad the core Date field.
from symphonycms.
Just for the records:
This problem resulted from the fact that the given date was in a short format (d/m/Y
) while Symphony expected a long date with time (d/m/Y H:i
) – so Symphony used the fallback given in line 135. As PHP expect American date formats and a British date format was given, Symphony confused day and month at this stage. To work around this issue we should check short and long system date formats – __SYM_DATETIME_FORMAT__
and __SYM_DATE_FORMAT__
– in line 116 and 121.
from symphonycms.
@designermonkey, @nilshoerrmann Does the above commits fix this issue for you?
from symphonycms.
Certainly does. Is this in for the next release, or is it going in as a bug fix? I would suggest bugfix.
from symphonycms.
It'll be in 2.2.2, I'm packaging up Beta 2 tomorrow.
from symphonycms.
Brilliant, cheers @nils and @brendo
from symphonycms.
Related Issues (20)
- Unable to upload any media HOT 4
- Fatal Error: DatabaseException - SELECT SQL_CACHE- The query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0. HOT 6
- Symphony Deprecated Warning: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated HOT 2
- Error installing Symphony 3.0.0 in PHP 7.3.7 HOT 6
- After successful, bare install of 3.0.0, clicking on Preferences -> Trying to access array offset on value of type null error
- Index column size too large. The maximum column size is 767 bytes
- call_user_func() expects parameter 1
- XSS vulnerability HOT 1
- vendor directory missing from 3.0.0 branch HOT 4
- Handle creation is broken in 2.7 HOT 4
- Error updating from 2.6.11 > 2.7.10 HOT 2
- XXE Vulnerability HOT 1
- Another Error updating Symphony 2.7.10 —> 3.0.0 in PHP 7+
- Login button touching password field
- Entries list .actions has no padding - missing body class .page-index
- Spaces missing in different PHP version HOT 3
- A htaccess file in root directory before Symphony CMS install
- Future of Symphony CMS HOT 13
- MySQL v8 Errors HOT 1
- The website is down HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from symphonycms.