Current Version is: 1.3
1.3 NOTES: Added custom error message to make it more understandable. Added the ‘sweaty palms’ setting that now actually does something 😉 Read the setting section below for more info.
Here’s a little extension to help date entry, both in SAEF forms and in the CP. Many times the default date formatting (YYYY-MM-DD HH:MM) is very confusing and not very user friendly. Blind Date applies a little date lovin for those in need.
It will accept any user readable date - if you can understand it Blind Date should be able to. Keep in mind that this extension relies heavily on the strtotime() PHP function, and as such that function is what determines whether a date is readable or not. Here’s some documentation about what date formats are readable: date input formats
When a date is found that can’t be parsed, it will throw a custom error (you can change this in the language file). It does a heroic job at attempting to understand dates though - supplying Jan 33rd will result in Feb 2nd for example - Blind Date is desperate for any action it can get!
Personality Quirks: (helpful tips) • Blind Date will cruise all date fields in the system (both SAEF and CP) - including entry_date, edit_date and expiration_date.
• By default, if no year is specified, then the current year is used. If a time is given along with the date that time will be honored - if no time is given it defaults to 12:01 AM.
• Be careful what you ask for! Your preferences (settings) can potentially lead to a horrible Blind Date experience! If you set a preference for one of the default system fields (like entry_date) then it applies to EVERY entry_date field throughout the system. You’ve been warned!
Helpful hints to make your Blind Date a successful one (settings):
Separate fields with a |.
Thinking Long Term? (force future date) - List the fields you would like to force into the future . Example: If today is March 15, 2007 and Jan 3rd is supplied, the resulting date will be Jan 3rd, 2008. If Jan 3rd 2005 is entered, the resulting date will be Jan 3rd, 2008. (this is handy for using with the ‘expiration_date’ field.)
Punctual to a Fault (force 12:01 AM) - Did you say something embarrassing, or maybe spill red wine on your date’s miniskirt? Rewind the clock - fields set here are forced to use 12:01 AM as the entry time.
Fashionably Late (honor time, otherwise 11:59 PM) - Want a long date but don’t want to seem desperate? Any field listed here will honor a time if it is given, and if no time is given will use 11:59 PM.
Disastrously Late (force 11:59 PM) - Oh boy. Ignore the time given and show up at 11:59 PM, no ifs, ands or buts. You might not be on time, but at least you have the day right. Hope you brought flowers.
Sweaty Palms? - If you have sweaty palms, it will force an empty expiration_date field to take on the same date as the entry_date field, but with a time of 11:59 PM (it expires at the end of the day).
Sue that was a good idea - thanks. I’ve added the ‘attractive back-end’ option - set that to yes and it will work in the CP as well.
Here’s a link to version 1.1 (until the forums get worked out):
I disabled it before uploading the newer version. I’ve been bit by that before. 😊
It works for the front end and back end. The one thing I did what to have happen is that if I click on an expiration date from the calendar, I want the date generated that way to automatically make it 12:59 PM, not to rely on me clearing the field.
Does that make sense? Clearing out the time portion works, but it also makes it not automatic for clients.
I disabled it before uploading the newer version. I’ve been bit by that before. 😊 It works for the front end and back end. The one thing I did what to have happen is that if I click on an expiration date from the calendar, I want the date generated that way to automatically make it 12:59 PM, not to rely on me clearing the field. Does that make sense? Clearing out the time portion works, but it also makes it not automatic for clients.
Ahh I see. That’s a different beast altogether. I’ll look at adding that in - it will probably be a bit before I have time to do it however.
Sue - when I do get a chance…
Would this be an ok solution: If someone uses the calendar and gets the javascript it would show the current time until it was submitted, when it would change to the forced 12:59. There would be a field in the settings that is for “ignore given times” - it’s a text input for the fields you want to override.
Or would that be too confusing? If I do the above it’s just a simple addition to the extension - otherwise I have to hook in and start messing around with the javascript that does the dates which is more work (and I hate javascript … :ahhh: )
Brian I love it. I’ve been able to throw pretty much any date string at it (2 months, yesterday, tomorrow etc) and it works great.
But if I enter complete jibberish it doesn’t throw an error. Or if I misspell something for example, 2 Desember 2005. Going by what you said below, if it can’t find a date it should throw an error right?
When a date is found that can’t be parsed, it will throw the normal error for an incorrectly formatted date (including mentioning that it needs to be in YYYY-MM-DD HH:MM format even though it doesn’t).
When attempting to use 1.2, I get the following error message:
Notice: Undefined variable: date_fields in /home/mydomain/public_html/system/extensions/ext.blind_date.php on line 114
Warning: Cannot modify header information - headers already sent by (output started at /home/mydomain/public_html/system/extensions/ext.blind_date.php:114) in /home/mydomain/public_html/system/core/core.functions.php on line 710
Warning: Cannot modify header information - headers already sent by (output started at /home/mydomain/public_html/system/extensions/ext.blind_date.php:114) in /home/mydomain/public_html/system/core/core.functions.php on line 296
EE Version: 1.5.2 20070302 EECore I’m only using two of the
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.