title: date-fns: Parse date string with given format
body: <p>I would like to replace <code>moment</code> by <code>date-fns</code> in one of my projects.</p>
  
  <p>From <code>moment</code>, I only use parse and timezone (with <code>moment-timezone</code>) functionnalities:</p>
  
  <pre class="lang-js prettyprint-override"><code>const moment = require('moment-timezone')
  
  const parseDatetime = function parseDatetime (datetime, format, tz = 'Europe/Paris', locale = 'fr') {
    return +moment.tz(datetime, format, locale, tz)
  }
  
  parseDatetime('jeudi 23 janvier 13:18:23', 'dddd DD MMMM HH:mm:ss')
  // =&gt; 1579781903000
  // Which outputs « 2020-01-23T12:18:23.000Z » (as expected) when given to Date constructor
  </code></pre>
  
  <p>With <code>date-fns</code>, I tried <code>format</code> function (which seems to be what I need) :</p>
  
  <pre class="lang-js prettyprint-override"><code>const format = require('date-fns/format')
  const fr = require('date-fns/locale/fr')
  
  format('jeudi 23 janvier 13:18:23', 'EEEE dd MMMM HH:mm:ss', {
    locale: fr
  })
  </code></pre>
  
  <p>First, I do not know if I should use <code>MMMM</code> or <code>LLLL</code> for month in locale format.</p>
  
  <p>Anyway, I get following error :</p>
  
  <p><code>Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule</code></p>
  
  <p>So I went to documentation about <code>parseISO</code>, where it states that it will « <em>Parse the given string in ISO 8601 format and return an instance of Date.</em> ». This is <strong>NOT</strong> what I need, as my date string isn’t in ISO 8601 format or any other ISO format.</p>
  
  <p>I found <code>parse</code> function, which seems to better fit my use case. So I tried :</p>
  
  <pre class="lang-js prettyprint-override"><code>const parse = require('date-fns/parse')
  const fr = require('date-fns/locale/fr')
  
  parse('jeudi 23 janvier 13:18:23', 'EEEE dd MMMM HH:mm:ss', Date(), {
    locale: fr
  })
  </code></pre>
  
  <p>Which gives me the exact same error as <code>format</code> !!! This behavior is weird, given that <code>parse</code>’s documentation states that <code>dateString</code> argument is… a string !</p>
  
  <p>So, I’m actually lost on this issue, if ever it is an issue.</p>
  
  <p>Could someone please give me some help / insights about this ?</p>