daily pastebin goal
45%
SHARE
TWEET

momentjs

a guest Mar 15th, 2016 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function()
  2. { //var moment = require('moment');
  3.     //moment.locale('pl');
  4.   // console.log(moment.locale());
  5.    var eDepartureMoment = document.getElementById("departureMoment");
  6.    var eArrivalMoment = document.getElementById("arrivalMoment");
  7.    
  8.   function departureDataClick(){
  9.     $("#departure").trigger("focus");
  10.   }
  11.     function arrivalDataClick(){
  12.     $("#arrival").trigger("focus");
  13.   }
  14.   function dataChange(idInput,dataMoment,dayMoment){
  15.       var departureInput= document.getElementById(idInput).value;
  16.       var eDataMoment = document.getElementById(dataMoment);
  17.       var eDayMoment = document.getElementById(dayMoment);
  18.       // instantiate a moment object
  19.     var departureMomentDay = moment(departureInput).format('DD');
  20.     var departureMoment = moment(departureInput).format('MMMM YYYY');
  21.     // var departureMoment = departureInput;
  22.  
  23.      
  24.      
  25.       eDayMoment.innerHTML = departureMomentDay;
  26.      
  27.       eDataMoment.innerHTML=departureMoment;
  28.   }
  29. //departure  
  30.   dataChange('departure','departureDataMoment','departureDayMoment');
  31.  
  32.    eDepartureMoment.addEventListener("click", departureDataClick);
  33.       $( "#departure" ).change(function() {
  34.  
  35.       dataChange('departure','departureDataMoment','departureDayMoment');
  36.    });
  37. //ARIVAL
  38.   dataChange('arrival','arrivalDataMoment','arrivalDayMoment');
  39.    eArrivalMoment.addEventListener("click", arrivalDataClick);
  40.       $( "#arrival" ).change(function() {
  41.  
  42.       dataChange('arrival','arrivalDataMoment','arrivalDayMoment');
  43.    });
  44.  
  45. })();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top