Skip to content

Conversation

@simonexmachina
Copy link
Contributor

I also added a reformat option to the methods. This reformats whatever is in the <input> value to be formatted using the dateFormat. However I could find a way to get access to timepicker's timeFormat option, nor could I get $.datepicker.formatTime() to behave with "09:00 am", so I have disabled this reformatting option when adding a timepicker.

Cheers,

Simon

@trentrichardson
Copy link
Owner

Thanks Simon, I'll review this and merge with the dev branch

@trentrichardson
Copy link
Owner

Simon, could you provide a quick example to test this by?

trentrichardson added a commit that referenced this pull request Aug 28, 2012
Added methods to enforce date range limits.
@trentrichardson trentrichardson merged commit 3d71f85 into trentrichardson:dev Aug 28, 2012
@simonexmachina
Copy link
Contributor Author

<p>Date range: <input type="text" name="startDate" value="Wed, 29 Aug 2012 07:00:00 +1000" />
<input type="text" name="endDate" value="" /></p>
<p>Time range: <input type="text" name="startTime" value="09:00 am" />
<input type="text" name="endTime" value="" /></p>
<script>
$(function() {
    $.timepicker.dateRange($('input[name=startDate]'), $('input[name=endDate]'), {
        dateFormat: 'D, dd M yy',
        reformat: true
    });
    $.timepicker.timeRange($('input[name=startTime]'), $('input[name=endTime]'), {
        ampm: true,
        reformat: true,
        start: { defaultValue: '07:00' },  // "07:00 am" doesn't seem to work
        end: { defaultValue: '07:00 pm' }
    });
});
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants