Set moment timezone in Jest tests
问题 I have the util function that is parsing given date (i.e. '2019-01-28') in specific date format and then using momentJS retrieving beginning of that day and converting it to ISO date format: dates.js import moment from 'moment' export const getApiDateFormat = (date, dateFormat = getLocaleDateString()) => moment(date, dateFormat) .startOf('day') .toISOString() I would like to test this function using Jest and set the specific timezone for moment to use those tests independent of my location.