Opened 4 years ago
Closed 3 years ago
#10309 closed defect (bug) (fixed)
Publish Date (Schedule) does not handle inputs properly.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.9 |
| Component: | Date/Time | Version: | 2.9 |
| Severity: | normal | Keywords: | has-patch tested |
| Cc: |
Description
Entering an invalid day does not show any error and deletes the whole datetime value after save. Clientside javascript does his own limbo.
Create a Post on 2009-06-30 and then schedule it by changing the day 30 to day 31. Then save the post.
Suggestions:
- Prevent the reset to unixtime of 0.
- Display an error message Clientside if a value is wrong
Attachments (4)
Change History (19)
- Milestone changed from Unassigned to 2.8.2
comment:3
camper2020 — 4 years ago
- Owner set to camper2020
- Status changed from new to accepted
Hi all, I am a third year student at the University of Pretoria in South Africa.
We were given a task of finding a well known open source architecture and atte,pting to write a patch for it. I chose wordpress and this partucular ticket.
I believe I have managed to fix this error, not in the javascript but in the "post.php" file. I have uploaded the new file. <Seen Above>
List of changes:
- Date no longer resets to Jan 1 1970.
- If an invalid date is entered, month and year are still accepted, and day resets to current day of month on user's local machine. (Not as much overhead to edit from there)
- Patch tests per month, i.e. Jan can have 31 days, April only 30 etc.
- Patch takes leap years into account and so for February, 28 days are the max allowed unless the given year corresponds to a leap year test, if so, February can accept 29 days.
- This patch is obviously only for Gregorian calendars :-)
I hope that this is satisfactory and that my code meets the standards of your great program. I have written two new methods: 'checkDates()' and 'checkDays()'.
The page still seems to load rather efficiently.
Any further queries: email me on johnston.jasond@…
Kind Regards
comment:4
camper2020 — 4 years ago
- Keywords Has Patch / Needs Testing added; needs-patch removed
- Keywords needs-patch added; Has Patch / Needs Testing removed
- Severity changed from major to normal
What version was that page created from? It doesn't look like current trunk or 2.8..
Maybe it would be best to re-attached it as an actual patch file?
At least for me, I can't test it as is as I don't know where it fits as a valid file.
comment:6
camper2020 — 4 years ago
Hi There
Sorry as its my first patch wasn't quite sure how to upload as a "proper" patch file, still not quite sure. Version wise, it is the latest version on Wordpress, 2.8.3. What I did was, I went into the actual PHP files of the Wordpress install directory, and modified the file.
The file location, if you did want to test it, would be
"installdir/wp-admin/includes/post.php"
Obviously back up the original file before overwriting it with mine, also, if you could guide, how would I go about submitting this patch along the correct channels?
(oh and don't be scared that its my first patch ;-))
Thanks and regards,
Jasond
Sure for info on creating patches see -
http://markjaquith.wordpress.com/2005/11/02/my-wordpress-toolbox/
http://blog.ftwr.co.uk/archives/2005/11/03/windows-wordpress-toolbox/
camper2020 — 4 years ago
comment:8
camper2020 — 4 years ago
I assume this is a better file to attach here :-)
hi camper,
thanks for the patch. please consider to not that much duplicate code (for example, multiple of the cases in the switch statement containt the same code, you can write those below each other) and the the coding guidelines (I normally do write the brackets like you do, but in this project there is some other guideline):
http://codex.wordpress.org/WordPress_Coding_Standards
Then I do not understand why you remove the 'trash' code in your patch. maybe this is by error?
comment:10
arena — 4 years ago
Hi all,
A completely different approach using select for touch_time function,
Handles leap years.
comment:11
arena — 4 years ago
- Keywords has-patch needs-testing added; needs-patch removed
comment:12
arena — 4 years ago
- Keywords tested added; needs-testing removed
comment:13
arena — 4 years ago
- Keywords needs-testing added; tested removed
- Version changed from 2.8 to 2.9
comment:14
arena — 4 years ago
- Keywords tested added; needs-testing removed
10309_latest.patch tested.
comment:15
azaozz — 3 years ago
- Resolution set to fixed
- Status changed from accepted to closed

This should be taken care of. It is really harsh to delete a users input completely only because he made a mistake.