Guest User

Untitled

a guest
Jul 23rd, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <input type="date" name="data-inicial">
  2. <input type="date" name="data-final">
  3.  
  4. <input type='date' id='d1' name='d1' min="">
  5. <input type='date' id='d2' name='d2' min="">
  6.  
  7. <script>
  8. $(document).ready(function() {
  9. $("#d1").change(function () {
  10. var split = $("#d1").val().split('-');
  11. var fim = new Date(parseInt(split[0]), parseInt(split[1]), parseInt(split[2]) + 29);
  12. $("#d2").attr({
  13. "min" : [fim.getFullYear(),
  14. (fim.getMonth() > 9 ? '' : '0') + fim.getMonth(),
  15. (fim.getDate() > 9 ? '' : '0') + fim.getDate()]
  16. .join('-')
  17. });
  18. });
  19. });
  20. </script>
Add Comment
Please, Sign In to add comment