The form below has a date field, a time field, and a numerical field.
Using JavaScript, I've made a change in the time field trigger code to check if the time is less than 24 hours in the future. This can be used to add a premium to last-minute bookings, disable submission, whatever you need to have happen.
In the current example, a message is shown and the value in the numerical field is changed if the date/time selected is less than 24 hours in the future.
The code to accomplish this is below:
(function($){
// Set variable to current date and time
const now = new Date();
let stamp = now.getTime();
let tomorrow = stamp + (86400000);
$('#field_time').change(function(){
let date_array = $('#field_date').val().split('/');
let time_array = $('#field_time').val().split(':');
const time_slot = new Date(date_array[2],(date_array[0] - 1),date_array[1],time_array[0],time_array[1]);
let time_stamp = time_slot.getTime();
if( time_stamp < tomorrow ) {
$('#field_price').val(100);
$('#field_notif').html('Your selected time is less than 24 hours in the future. Last-minute bookings are subject to a surcharge.');
} else {
$('#field_price').val(50);
$('#field_notif').html('Your selected time provides adequate notice, so no surcharge will be levied.');
}
});
})(jQuery)
Isn't technology supposed to make life easier? I recently built a tool for a provider of an ERP system, to allow his clients to automatically publish inventory to their business websites and keep the sites in synch with his system. It got me thinking (again) about automation, and how business can do more with tools they're already using.
A lot of people - even companies - that provide technical services find themselves in the unfortunate position of being viewed as "the techs" and ignored when discussion turns to policy, marketing, or other topics relating to business management and strategy - the domain of consultants. This can be the case whether the tech is a twenty-something fresh out of school, or someone who's been in the industry for decades.
It's difficult to change people's perception once you've been slotted into a role. Far better to set expectations at the beginning of a relationship than try to change mid-stride.
I should have known better, but I was hit with a wave of panic when the government announced the beginning of the corona virus lock down. I thought that might be it for my business. How would I get new clients? What about the meetings I had already scheduled? What if everybody stopped spending? Even in a digital business it's sometimes difficult to see past traditional expectations.
Viewing your website(s) as a necessary expense rather than as an investment that's expected to produce a return is a critical misstep. Business owners often have a difficult time defining the role of their Website in their online presence and marketing. People often confess to feeling overwhelmed by technology, and rather than deal with the complexity, they settle for a site that's less functional than a business card or a billboard.
Begin Your Digital Transformation
Subscribe To Our Newsletter
Join our mailing list to receive the latest news and updates from our team.