gdolenc
gdolenc

Reputation: 311

How to limit minimum possible date/time in jtsage datetimebox?

anybody knows or has an example of how to set limitation of minimum allowed datetime in the datetimebox in jtsage script?

My case is the following - I have a form where user enters tennis game, and there are two date/time related fields: GameStart and GameEnd.

Once the user sets GameStart (which can be any time in the future), for example 2018-02-25 13:00, I would like to limit the GameEnd minimum to the same date/time as the user has selected as GameStart. In this particular example user should not be able to set datetime lower than 2018-02-25 13:00.

To put it in other words, user cannot select GameEnd before GameStart. Makes sense, right?

I have a callback JavaScript function, which triggers just fine, reads the GameStart ad datetime object. But once I set min and applyMinMax, it just doesn't work.

This is my code:

            var minDate = $('#GameStarts').datebox('getTheDate');
            $('#GameEnds').attr('min', minDate);
            $('#GameEnds').datebox('applyMinMax');

Any idea?

Upvotes: 0

Views: 99

Answers (0)

Related Questions