Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[issue] article time stamp and incorrect date
Today I wanted to display an article in the future, but instead of altering the publication time, i altered the publication date. i inserted into the field for the month the value “18” which is not valid.
textpattern didn’t show a message, as i would expect. instead, the publication date was changed to 1970-01-01 which is really not the behaviour i expect.
could there an error message inserted?
Offline
#2 2006-12-13 15:42:05
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: [issue] article time stamp and incorrect date
I don’t know for certain, but yes, I think there’s no error checking done there, and there should be.
The question is how to handle it properly. I’m thinking force dates into the correct structure (so 18 becomes 12, etc), but give you a warning (like we warn about duplicate url titles, for instance).
Offline
Re: [issue] article time stamp and incorrect date
or probably just no change if the inserted value is not correct, i.e. if the inserted date is not valid, e.g. the 30th february :)
Offline
#4 2006-12-13 16:00:56
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: [issue] article time stamp and incorrect date
Unless you’re referring to some kind of JavaScript early warning, which I can see, that wouldn’t be a good idea: the result would be completely losing all your changes. That’d be the quickest way to send most people into orbit. ;p
Offline
Re: [issue] article time stamp and incorrect date
well, for that, i’m not deep enough in the code.
i just thought:
when user clicks “save”
1. check if entered date is valid
2. if date is not valid, use the value, which was stored in the db.
problem: if user changes date to invalid value before 1st save. then you could use the current date.
or you can go for:
if entered date is not valid, use current date
in both cases the user should get a error message.
Offline
Re: [issue] article time stamp and incorrect date
- store the old date (or current date for new articles) in a hidden form field when displaying the article edit page.
- after saving the article, fetch the stored date from the database, compare it with the date entered by the user. If they differ, restore the old date (stored in hidden field), otherwise it’s okay.
It costs an extra, but simple query on each article save, but avoids having to add complex date validation code in TXP
Last edited by ruud (2006-12-13 17:50:18)
Offline
#7 2008-12-01 14:59:38
- hongster
- New Member
- Registered: 2008-12-01
- Posts: 7
Re: [issue] article time stamp and incorrect date
The-Exit wrote:
well, for that, i’m not deep enough in the code.
i just thought:
when user clicks “save”
1. check if entered date is valid
2. if date is not valid, use the value, which was stored in the db.problem: if user changes date to invalid value before 1st save. then you could use the current date.
or you can go for:
if entered date is not valid, use current datein both cases the user should get a error message.
I agree with those suggestions. By default, the input fields for article expiry date is empty, when new article is created. When I edit the article and click “Save”, SQL error message appeared on top of the page!
The error start with the following string:
Incorrect datetime value: '0' for column 'Expires' at row 1 update txp_textpattern set Title = ...
Offline
Re: [issue] article time stamp and incorrect date
hongster, which MySQL version are you using?
Offline
#9 2008-12-01 15:39:03
- hongster
- New Member
- Registered: 2008-12-01
- Posts: 7
Re: [issue] article time stamp and incorrect date
MySQL 5.0.45
Offline
Re: [issue] article time stamp and incorrect date
hongster, can you open a new topic for this specific error and include exact steps to reproduce. This appears to be something that is dependent on MySQL version and may be a bug in TXP.
This topic is quite old and deals with a problem that’s not related to the error message you’re getting.
Offline
#11 2008-12-01 22:32:08
- rooon
- New Member
- From: Melbourne, Australia
- Registered: 2008-12-01
- Posts: 7
Re: [issue] article time stamp and incorrect date
I’m also getting this error… was the new topic created?
Offline
Re: [issue] article time stamp and incorrect date
No, but feel free to do so yourself.
Offline