Tempus-dominus: keyBind "t" is a painful default

Created on 2 Jun 2016  Â·  10Comments  Â·  Source: Eonasdan/tempus-dominus

The product is great but the keyBind "t" is a trap for the unwary. I use the dd mmm yyyy format (eg 2 Jun 2016) to enable users to see and enter unambiguous dates where months and day of month order are interchanged depending on where you live.

As it happened during product testing Oct was not used in test input data - as soon as someone did (in production of course) today's date comes up as soon as the "t" is typed - and October is the only month affected. Once the "bug" was found is was relatively easily overcome using the keyBind option to override the default - but it was painful for a little while!

In future releases could you consider using a different key for "today's date" - like a letter not used in months (x,z,q etc).

Thanks for your consideration .... as I said a great product!

Regards

Geoff
(Sydney Australia)

v4

Most helpful comment

In the documentation (under options)
http://eonasdan.github.io/bootstrap-datetimepicker/Options/#keybinds
you will see keypress "t" is bound by
t: function () {
this.date(moment());
},

I removed the existing keybind .... For example (using jquery and also changing the date format) ....
$( document ).ready( function() {
$('.datetimepicker').datetimepicker({
format: 'DD MMM YYYY',
keyBinds: 't: '
});
})

All 10 comments

Ditto. Having the same bug reported. Type Oc and then t and it resets the date to today!

Also having this issue, with both Sept and Oct. @geoffg1953 Can you share the code you used to fix this issue? Thank you! :)

In the documentation (under options)
http://eonasdan.github.io/bootstrap-datetimepicker/Options/#keybinds
you will see keypress "t" is bound by
t: function () {
this.date(moment());
},

I removed the existing keybind .... For example (using jquery and also changing the date format) ....
$( document ).ready( function() {
$('.datetimepicker').datetimepicker({
format: 'DD MMM YYYY',
keyBinds: 't: '
});
})

Thank you so much @geoffg1953!!! If there were upvotes here, I'd give you one :)

Laura,

In the documentation (under options)
http://eonasdan.github.io/bootstrap-datetimepicker/Options/#keybinds
you will see keypress "t" is bound by
t: function () {
this.date(moment());
},

I removed the existing keybind .... For example (using jquery and also changing the date format) ....
$( document ).ready( function() {
$('.datetimepicker').datetimepicker({
format: 'DD MMM YYYY',
keyBinds: 't: '
});
})

Regards

Geoff

M; +61 413 619 993 E:mailto:[email protected]

This email plus any attachments to it are confidential. Any unauthorised use is strictly prohibited. If you receive this email in error, please delete it and any attachments.
P Please think of our environment and only print this E-Mail if necessary.

From: lauraspeck [mailto:[email protected]]
Sent: Wednesday, 26 October 2016 12:02 PM
To: Eonasdan/bootstrap-datetimepicker [email protected]
Cc: Geoff Gordon g.[email protected]; Mention [email protected]
Subject: Re: [Eonasdan/bootstrap-datetimepicker] keyBind "t" is a painful default (#1639)

Also having this issue, with both Sept and Oct. @geoffg1953https://github.com/geoffg1953 Can you share the code you used to fix this issue? Thank you! :)

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/Eonasdan/bootstrap-datetimepicker/issues/1639#issuecomment-256221840, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEZWz1TvUcvHH5hMh8RLod8Xv-fWmslqks5q3qZ9gaJpZM4IsNHe.

Same issue. Couldn't figure out how to remove that pesky binding. Thanks.

A potentially useful fix - were someone to implement one - would be to have the 't' key only work when the edit field is empty.

I know this is an old posting but I'm having a real hard time with this keybinding options stuff.
I want to ONLY disable the keybind for delete key.
I've tried keyBinds: {'delete': null}
I've tried keyBinds: {'delete': {}}
It partially works being that I can now use the delete key but by doing so ALL other options for the keyBinds are not working which I want to keep them.
How may I only remove the delete keyBind but retain all the other keyBind defaults? I've spent days on this so far.

After generating the datetime picked we need to set below option to remove keybind 't' event.

$(element).data("DateTimePicker").keyBinds({ 't': undefined });

Hello. Thanks for using my project. We’re closing all tickets/prs for v4 as it is no longer supported. We’re making way for a new version. Please read this blog post

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dleffler picture dleffler  Â·  4Comments

am11 picture am11  Â·  6Comments

miraclebg picture miraclebg  Â·  3Comments

sjvisschers picture sjvisschers  Â·  5Comments

dungphanxuan picture dungphanxuan  Â·  3Comments