Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled Day of Week setting changes initial date value #1289

Closed
benr77 opened this issue Aug 27, 2015 · 4 comments
Closed

Disabled Day of Week setting changes initial date value #1289

benr77 opened this issue Aug 27, 2015 · 4 comments

Comments

@benr77
Copy link

benr77 commented Aug 27, 2015

When using daysOfWeekDisabled - if an existing value is defined in the form field then this is modified upon initialisation to show the next allowable date in the future as defined by the allowable days of the week

<input type="text" class="form-control" id="datetimepicker2" data-date-format="DD MMMM YYYY" data-date-view-mode="months" data-date-days-of-week-disabled="[0,1,2,3,4,5]" value="08 August 2015" />

i.e. if the date is Thursday 27th August and only Saturdays are permitted, the existing form field value is ignored and field value is modified to be the next Saturday in future after the 27th August - in this case the 29th August.

This is before you click on a date field to pop-up the date picker.

See JSFiddle for example behaviour
https://jsfiddle.net/benr77/jou6dwo3/1/

@benr77
Copy link
Author

benr77 commented Aug 27, 2015

After further investigation I see that explicitly setting data-date-use-current="false" corrects this behaviour. (from a hunch from reading #885)

However, reading the docs at https://eonasdan.github.io/bootstrap-datetimepicker/Functions/#usecurrent it states that if the field already has a valid value then the use of useCurrent is ignored. In the case described by my previous post this is not the case so I still think this is a bug or the documentation needs amending.

@NoCoffeeBreaks
Copy link

NoCoffeeBreaks commented Jun 29, 2016

I have experienced this problem as well -> defaultDate: moment(), fixes my problem

@SayyesTono
Copy link

benr77, you are a life saver!!! The data-date-use-current="false" works like a charm. EXCELLENT job there buddy!

@eonasdan-bot
Copy link
Collaborator

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

Repository owner locked and limited conversation to collaborators Nov 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants