Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input type="date" name="data-inicial">
- <input type="date" name="data-final">
- <input type='date' id='d1' name='d1' min="">
- <input type='date' id='d2' name='d2' min="">
- <script>
- $(document).ready(function() {
- $("#d1").change(function () {
- var split = $("#d1").val().split('-');
- var fim = new Date(parseInt(split[0]), parseInt(split[1]), parseInt(split[2]) + 29);
- $("#d2").attr({
- "min" : [fim.getFullYear(),
- (fim.getMonth() > 9 ? '' : '0') + fim.getMonth(),
- (fim.getDate() > 9 ? '' : '0') + fim.getDate()]
- .join('-')
- });
- });
- });
- </script>
Add Comment
Please, Sign In to add comment