blob: 6b4141c605a81e7a06a43caf2a3b17d9e2bb90e2 [file] [log] [blame]
Dixsie Wolmersfcda2002020-07-29 14:18:44 -05001import { format } from 'date-fns-tz';
2
3const LocalTimezoneLabelMixin = {
4 methods: {
5 localOffset() {
6 const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
7 const shortTz = this.$options.filters.shortTimeZone(new Date());
8 const pattern = `'${shortTz}' O`;
9 return format(new Date(), pattern, { timezone }).replace('GMT', 'UTC');
Derick Montague602e98a2020-10-21 16:20:00 -050010 },
11 },
Dixsie Wolmersfcda2002020-07-29 14:18:44 -050012};
13
14export default LocalTimezoneLabelMixin;