Guest User

Untitled

a guest
May 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. <input type="date" id="a">
  2.  
  3. <script>
  4. this.toDateInput = Symbol( 'czNic::Date' );
  5. Date.prototype[ this.toDateInput ] = function ()
  6. {
  7. return new Date( this.getTime() - ( this.getTimezoneOffset() * 60000 ) ).toISOString().split( 'T' )[ 0 ];
  8. };
  9. const b = new Date();
  10. document.getElementById('a').value = b[ this.toDateInput ]();
  11. </script>
Add Comment
Please, Sign In to add comment