title: How to guess user's timezone using date-fns?
body: <p>I have a requirement, where I need to show a user's time in their local time zone. This needs to be done using date-fns.</p>
  
  <p>The following code checks the current time and then given a timezone converts it into local time as per the time zone.</p>
  
  <pre><code>const { formatToTimeZone } = require('date-fns-timezone')
  
  let date = new Date()
  const format = 'D.M.YYYY HH:mm:ss [GMT]Z (z)'
  const output = formatToTimeZone(date, format, { timeZone: 'Asia/Calcutta' })
  </code></pre>
  
  <p>However, how do I guess the user's timezone on the fly?</p>
  
  <p>In <code>moment.js</code>, you can get it with <code>moment.tz.guess()</code>. But how can I do it without <code>moment.js</code> and by using <code>date-fns</code>?</p>
  
  <p><a href="https://runkit.com/embed/835tsn9a87so" rel="noreferrer">https://runkit.com/embed/835tsn9a87so</a></p>
  
  <p>UPDATE: I will be using this inside a VueJS application. So, if there are any other related solutions, those are welcomed as well. Thanks.</p>