title: Manipulating the day of month of moment.js
body: <p>I am building a planner that the user is able to add new events to. The date the user types in should become the date the event appears on.</p>
  <pre><code>const addEvent = (e) =&gt; {
      const newEvents = [...events];
      newEvents.push({
        title: eventValue,
        start: startValue,
        end: moment()
      });console.log(events)
      setEvents(newEvents);
    };
    const startOfMonth = moment().startOf('month').format('DD')
  
  </code></pre>
  <p>And the input</p>
  <pre><code>&lt;input
            id=&quot;startInput&quot;
            name=&quot;startInput&quot;
            value={startValue}
            onChange={(e) =&gt; {
             
             setStartValue(parseInt(startOfMonth) + parseInt(e.target.value) -1)
            }}
          /&gt;
  
  </code></pre>
  <p>My original idea was to have the user's input be added to the first day of the month (-1), so that if the user entered '12' the calendar's <code>startValue</code> would be 12. This worked, however the calendar I am using only recognized moment.js's date format which is the following.</p>
  <pre><code>Sat Dec 05 2020 08:40:31 GMT-0800 
  </code></pre>
  <p>So when my <code>startValue</code> was 12, the calendar did not recognize it. <br />
  How do I change only the day of the month in a moment.js format?</p>
  <br />
  My first attempt was this. 
  <pre><code>let tempValue = (parseInt(startOfMonth) + parseInt(e.target.value) -1)
             setStartValue(moment().format(`MMMM ${tempValue} YYYY, h:mm:ss a`))
  
  </code></pre>
  <p>However this only puts the current time in the input box without me even pressing the button, and I'm not sure why.
  <br />
  My full code is here <a href="https://github.com/Imstupidpleasehelp/AimhighChallege/blob/master/src/App.js" rel="nofollow noreferrer">Link</a>
  <br />
  And here is a code sandbox <a href="https://codesandbox.io/s/compassionate-elbakyan-6dxl6" rel="nofollow noreferrer">Sandbox</a>
  <br />Thank you for your time.</p>