BFD Calendar Posted December 30, 2018 Posted December 30, 2018 Am I right that this field cannot be used in a FormBuilder form? I'm trying to make a form with a start and stop button to calculate time students spend on one of our lasercutting machines. [edit] In the meantime I found it. Now I just wanted to know if I can have the time 'auto fill in' in a field 'laser_start' as soon as a new form is created, like I can with a Datetime field. And also have a button or picker to enter the time in a field 'laser_stop' when I edit the page created by Formbuilder. Another issue: the Time Format always jumps to 'Minutes (00-59) & seconds (00-59).' when I choose 'Hours (0-24), Minutes (00-59) & seconds (00-59)' upon save in the Details tab.
Tom. Posted February 1, 2019 Posted February 1, 2019 On 12/30/2018 at 12:38 PM, BFD Calendar said: Another issue: the Time Format always jumps to 'Minutes (00-59) & seconds (00-59).' when I choose 'Hours (0-24), Minutes (00-59) & seconds (00-59)' upon save in the Details tab. I'm also having this issue, which isn't letting me use the date() formatting due to this. ? Also when it does jump to that, the time selector GUI doesn't work.
BFD Calendar Posted February 5, 2019 Posted February 5, 2019 @Tom. For what it's worth, this is how I solved my problem, maybe it helps you to find your solution. // DATE CALCULATION $laserdate = date('d F Y', strtotime($feature->lendout_time)); $lasertimestart = date('H:i:s', strtotime($feature->lendout_time)); $lasertimestop = date('H:i:s', strtotime($feature->return_time)); $start_time = new DateTime($feature->lendout_time); $since_start = $start_time->diff(new DateTime($feature->return_time)); $minutes = $since_start->h * 60; $minutes += $since_start->i; $lasertime = gmdate("H:i:s", strtotime($feature->return_time) - strtotime($feature->lendout_time)); // RESULT if($feature->return_time) { echo "<li><span class='verdana'>{$laserdate} -> {$studentspage->title} | {$feature->machine} => <b>{$lasertimestart} -> {$lasertimestop}</b> = {$since_start->h}:{$since_start->i}:{$since_start->s} or <font color='green'><b>{$minutes} minutes - done</b></font></span>.</li>"; } else { echo "<li><a href='{$feature->url}'><span class='verdana'>{$laserdate} -> {$studentspage->title} | {$feature->machine} => <b>{$lasertimestart} -> <font color='red'>busy</b></font></span>.</a></li>"; }; You can see it working here below the Google calendar: https://mekano.info/en/calendar/
J_Szwarga Posted August 15, 2019 Posted August 15, 2019 Can this module be altered to work with 12 HR instead of 24 HR?
netcarver Posted August 15, 2019 Author Posted August 15, 2019 @J_Szwarga Thanks for the post. If you only need to output in 12 hour format, you can probably do it like this within your template files (untested)... # Pull the values from our page's time field... $timeparts = FieldtypeTime::getTimeParts($page->timefield); # Adjust name of field as needed. # Adjust the sign $sign = (empty($timeparts['sign']) ? '+' : '-'; # Create a time, based on the start of today, with the offset hours, mins and seconds from the timeparts. # See: https://www.php.net/manual/en/function.strtotime.php $time = strtotime("today $sign {$timeparts['hours']} hours {$timeparts['mins']} mins {$timeparts['secs']} secs"); # Format it for output as needed, in this case as 12hours with lowercase am/pm marker. # See: https://www.php.net/manual/en/function.date.php echo date("ga", $time);
bernhard Posted February 7, 2020 Posted February 7, 2020 Hi @netcarver thx for the great module! Would you mind renaming the title of the module to "Time" only without the Fieldtype? It would make selecting it easier (I'm using the keyboard most of the time and it would be nice (and consistent) to type "time" instead of "fieldtype time"). Another little glitch: The field is set to this format: After selecting a time, the format is correct (eg 18:30), but initially it displays seconds (which is not wanted).
adrian Posted February 21, 2020 Posted February 21, 2020 @netcarver - is it time to add PW 3.x to the compatibility options for this module (in the modules directory listing) ?
Andi Posted April 12, 2020 Posted April 12, 2020 @netcarver Field is showing "PLACEHOLDER" when empty, is that intentional or is there a way to configure the placeholder value? Also a default value option would be very, very neat. I'm running this on an event planner that has events almost always starting around the same time of day. Would that be hard to implement? Running version 0.2.2, field is inside a repeater in this case. Thanks a bunch! 1
Andi Posted April 23, 2020 Posted April 23, 2020 This is the line https://github.com/netcarver/PW-FieldtypeTime/blob/4332e922d6c8e98b64e8e6e408ad7c71e318ffff/InputfieldTime.module#L83 So for the time being, in InputfieldTime.module change line 83 to something like $attrs['placeholder'] = "00:00"; 1
salmiak Posted April 23, 2020 Posted April 23, 2020 Setting a custom placeholder (or a default value) would be useful for my site too.
Mike-it Posted February 9, 2021 Posted February 9, 2021 It looks great! Wanted to test but got: "This module does not indicate compatibility with this version of ProcessWire." Is it safe to use it anyway? I think @adrian suggestion is correct to add PW 3.x compatibility ? 1
Ralf Posted March 11, 2023 Posted March 11, 2023 @netcarver it's been two years since the last post and I wanted to politely ask if you could take another look at this module to make it PW 3.x ready? Would be cool to have the installation without all these hints regarding incompatibility ? Many thanks in advance
netcarver Posted March 12, 2023 Author Posted March 12, 2023 @Ralf Please would you try out the new, ng branch, and let me know how it goes. Spoiler Various Updates * PW 3+ * PHP 7.2+ * Modern array syntax * Fix: Name in field type list * Fix: Incorrect format selection * Feat: Add appropriate placeholder based on format * Feat: Add title attr from format description * Chore: More consistent strings * Chore: More consistent functions * Chore: More type hinting The ng branch on github. Direct download link for the ng branch zip. Not for production sites at the moment. Thank you. 1
Ralf Posted March 23 Posted March 23 @netcarver many thanks for the update and the great additions. Even if my feedback comes a little late... I've since had it in “productive” use on a few sites and so far everything looks good. So from my side a CLEAR Go for a new release! Many thanks and best regards cu
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now