windowsiana

package module
v0.0.0-...-b76d403 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2022 License: Unlicense Imports: 2 Imported by: 0

README

windowsiana

GoDoc Go Report Card

A very simple package that helps when dealing with Windows timezones and mapping them to standard timezones.

I created this package to handle times that were sent back from a web service that were sent with details of the Windows timezone to which they were tied. In order to make the time usable in Go, I created this little package to allow me to convert an inbound Windows time into a propert time.

The list is also inspired by the Microsoft Graph API and as of 21st of May 2019 is compatible to all outlookUser supportedTimeZones

Technical prerequisites to develop/build

The program is as of 07/2021 developed with Visual Studio Code and several plugins. For enhanced compatibility and easier upgrading, golang is not installed locally anymore, but instead used via a docker container. Therefore the following may be installed on the development machine to develop without a local golang installation:

  1. Docker Engine
  2. Visual Studio Code with the following plugins:

The docker container used always uses the latest version of golang.

The list is also inspired by the Microsoft Graph API and as of 21st of July 2021 is compatible to all outlookUser supportedTimeZones

Documentation

Overview

Package windowsiana provides support in converting date timezones from the non-standard windows timezone format into UTC. It also provides a function to return a timezone-aware date given a date string and an IANA timezone the date can then be used as a UTC date via the .UTC() function

Index

Constants

This section is empty.

Variables

View Source
var WinIANA = map[string]string{}/* 156 elements not displayed */

WinIANA is a pseudo constant that provides a mapping between the Windows timezones and the IANA zones CAUTION : I can't vouch for the ongoing reliability/accuracy of the mapping, which is partly why I've made this an accessible variable so that you can update it at runtime if needs be

Functions

func StripTimezoneFromDate

func StripTimezoneFromDate(indate time.Time) time.Time

StripTimezoneFromDate removes the same point in time and date, but strips apart the timezone

func TimezoneParseIANA

func TimezoneParseIANA(tstring string, tzone string) (time.Time, error)

TimezoneParseIANA accepts a timestring in the format "2006-01-02T15:04:05" as the tstring parameter and am IANA time zone (eg "Pacific/Fiji") as the timezone. It will return a timezoned date, which will correctly handle daylight savings time if it's in force at the given date

func TimezoneParseWindows

func TimezoneParseWindows(tstring string, tzone string) (time.Time, error)

TimezoneParseWindows accepts a timestring in the format "2006-01-02T15:04:05" as the tstring parameter and a windows time zone (eg "(UTC+12:00) Fiji") as the timezone. It will return a timezoned date, which will correctly handle daylight savings time if it's in force at the given date

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL