Set timezone React-Datepicker

MarksCode picture MarksCode · Oct 29, 2018 · Viewed 17.3k times · Source

I'm using the react-datepicker to let user select a date. However, right now it uses local time (PDT), but I want to hardcode it to use a specific timezone (PST).

I tried using utcOffset prop but it doesn't seem to be doing anything. Does anyone know how to accomplish this?

Answer

Matt2772 picture Matt2772 · Oct 23, 2019

For my part I set the defaultTimezone before rendering the React-dates plugin. React-dates will just use the default timezone.

moment.tz.setDefault('America/Los_Angeles');