jonthornton / Datepair.js

A javascript plugin for intelligently selecting date and time ranges, inspired by Google Calendar.
https://www.jonthornton.com/Datepair.js
358 stars 87 forks source link

Datepair.js #75

Closed kkaiser1952 closed 8 years ago

kkaiser1952 commented 8 years ago

I'm working on a project for Amateur Radio and the Boy Scouts. I really like the simplicity of asking for a date & time to start and then a time & date to end. But I can't get it working. Any chance you could take a quick look for me?

http://bsaroundtable.org/scota/activation.php

-- Keith, WA0TJT wa0tjt@gmail.com

safiweb2 commented 8 years ago

Checking your source, you need to initialize correctly i.e your date input are enclosed under div id basicExample therefore change:

`

$('#jqueryExample .time').timepicker({
    'showDuration': true,
    'timeFormat': 'g:ia'
});

$('#jqueryExample .date').datepicker({
    'format': 'm/d/yyyy',
    'autoclose': true
});

// initialize datepair
$('#jqueryExample').datepair();

`

to

`

$('#basicExample .time').timepicker({
    'showDuration': true,
    'timeFormat': 'g:ia'
});

$('#basicExample .date').datepicker({
    'format': 'm/d/yyyy',
    'autoclose': true
});

// initialize datepair
$('#basicExample').datepair();

`

jonthornton commented 8 years ago

Thanks @safiweb!

@kkaiser1952 I'm an Eagle Scout and I'm thrilled to hear this plugin is being used on a Scouting site. Let me know if I can be of any help!

kkaiser1952 commented 8 years ago

Thats very cool, congratulations on earning Eagle. When and where did you earn your Eagle? As a kid I never made it but I’ve been an adult leader now since 1981, so 35 years or so. My son made Eagle back in 1994 but I never left the program. Check out my web site at http://bsaroundtable.org http://bsaroundtable.org/

This program I’m writing is for a combination Amateur Radio and Scouting program called SCOTA or Scout Camps On The Air, it’s goal is to get Scouts from around the world on Ham Radio.

You could be a little help with the plugin. My current input looks like this:

Which gets fed into MySQL via a PHP script.

I’d like the default format to be ISO standard YYYY-MM-DD but frankly I’m struggling with getting it to work.

Also I’m wondering if I can set the default times? For example I’m asking for a start time and an end time. I’d like to set the start to 8:00am and the end to 6:00pm.

Thanks man!

On Jul 7, 2016, at 8:35 AM, Jon Thornton notifications@github.com wrote:

Thanks @safiweb https://github.com/safiweb!

@kkaiser1952 https://github.com/kkaiser1952 I'm an Eagle Scout and I'm thrilled to hear this plugin is being used on a Scouting site. Let me know if I can be of any help!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jonthornton/Datepair.js/issues/75#issuecomment-231079094, or mute the thread https://github.com/notifications/unsubscribe/ADRUHLmf-ZfONlkwmY9lwBi0MIMi-QG1ks5qTQC0gaJpZM4JGSQ9.

jonthornton commented 8 years ago

Changing the datepicker format option should get you MySQL formatted dates.

$('#jqueryExample .date').datepicker({
    'format': 'yyyy-mm-dd',
    'autoclose': true
});

Set a default by putting a value attribute on the input:

<input type="text" class="time end" name="timeEnd" value="6:00pm" />

I made Eagle in 1999 in the Rip Van Winkle council (upstate NY). Haven't been as involved as I'd like since then, but I'll get there when I eventually settle down. The ham radio project sounds like a great idea. Best of luck with it!