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

defaultTimeDelta not used if field already filled #99

Open
footcow opened this issue Aug 22, 2017 · 0 comments
Open

defaultTimeDelta not used if field already filled #99

footcow opened this issue Aug 22, 2017 · 0 comments

Comments

@footcow
Copy link

footcow commented Aug 22, 2017

Hello,

If you set a defaultTimeDelta to null for example then load a form with a time defined for both fields, start and end.
If you set an anchor to start.

Then each time you modify the start field it'll add 3 hours to the end one.

defaultTimeDelta is not used in this case.

It works only if end date field is empty.

So I modified your code like this to have the defaultTimeDelta value used in all cases.

        _timeChanged: function(target){
            if (!this.startTimeInput || !this.endTimeInput) {
                return;
            }

            var startTime = this.settings.parseTime(this.startTimeInput);
            var endTime = this.settings.parseTime(this.endTimeInput);

            // Added those lines to have defaultTimeDelta really functionnal
            if (this.settings.defaultTimeDelta !== null) {
                this.timeDelta = this.settings.defaultTimeDelta;
            } else {
                this.timeDelta = null;
            }

            if (!startTime || !endTime) {
etc.

May be you will have a better solution, but it's works for me like this.
Pretty sure it's the same for DefaultDateDelta ... but I do not use it right now ;)

Regards,
Hervé

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

No branches or pull requests

1 participant