Dixsie Wolmers | fcda200 | 2020-07-29 14:18:44 -0500 | [diff] [blame] | 1 | import { format } from 'date-fns-tz'; |
| 2 | |
| 3 | const 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 Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame^] | 10 | }, |
| 11 | }, |
Dixsie Wolmers | fcda200 | 2020-07-29 14:18:44 -0500 | [diff] [blame] | 12 | }; |
| 13 | |
| 14 | export default LocalTimezoneLabelMixin; |