Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Added the getTime method #40

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from

Conversation

JordyMoos
Copy link

Added the getTime method which returns a Date object, the hours and minutes will be added to today.

// Get the time of single clockpicker
var dateObject = $('#demo-input').clockpicker('getTime');
console.log(dateObject);

// Get the time of a clockpicker list
$('.clockpicker').clockpicker('getTime', function(dateObject) {
    // The clockpicker element
    console.log(this);
    console.log(dateObject);
});

Also allows you to add a Date object as the 'default' options.
It will only use the Date object to get the time. It will not update the Date object when the time changes

$('#single-input').clockpicker({
    'default': new Date('Wed, 09 Aug 1995 13:15:00')
});

- Allow to add a Date as the 'default' options
@marcusklaas
Copy link

Lekker bezig Moosje!


// Minutes can have AM/PM that needs to be removed
this.hours = + value[0] || 0;
this.minutes = + (value[1] + '').replace(/\D/g, '') || 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the first + be there? What does it do?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casts it to a number

@piernik
Copy link

piernik commented Dec 12, 2014

It's good addition. Where Can I get version with it? It's no in official repo.

@JordyMoos
Copy link
Author

@piernik Thanks!

It is not in the official repo yet, @weareoutman needs to approve it first :)


if (this.twelvehour) {
var period = (value[1] + '').replace(/\d+/g, '').toLowerCase();
this.amOrPm = this.hours < 12 || period === 'am' ? 'AM' : 'PM';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

12:00AM and 12:00PM both get converted to 12:00PM.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattkrick You are right fixed the issue in this commit
JordyMoos@6f0ac5f

@gicappa
Copy link

gicappa commented Feb 11, 2016

Is the project still supported? I'm asking because I think this pull is quite important and it's been opened in Dec 4, 2014 but I can't see any feedback from the maintainers about the possibility of a merge.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants