@botonic/plugin-contentful
Version:
Botonic Plugin Contentful is one of the **[available](https://github.com/hubtype/botonic/tree/master/packages)** plugins for Botonic. **[Contentful](http://www.contentful.com)** is a CMS (Content Management System) which manages contents of a great variet
16 lines (14 loc) • 385 B
text/typescript
import momentTz from 'moment-timezone'
/**
* @return the offset of specified timezone with respect to offset of local timezone
* at specified date
*/
export function offsetWithTimeZone(
timeZone: momentTz.MomentZone,
date: Date
): number {
const offset =
new Date(date.getTime()).getTimezoneOffset() -
timeZone.utcOffset(date.getTime())
return offset * 60 * 1000
}