haskell / win32

Haskell support for the Win32 API
http://hackage.haskell.org/package/Win32
Other
97 stars 63 forks source link

Fix #153 Add `fromDateFormatPicture` and `fromTimeFormatPicture` #154

Closed mpilgrem closed 4 years ago

mpilgrem commented 4 years ago

Description

Provides two utility functions (exported by System.Win32.Utils) that translate the date or time format pictures used by the Windows API (see here and here) to the nearest equivalent format strings used by Data.Time.Format.formatTime of the time package.

For example (for locale nl-NL), Windows format picture dddd d MMMM yyyy is translated to format string %A %-e %B %Y.

Also applies hlint hints to System.Win32.Utils.hs, so that the whole module passes hlint.

Tested by

Motivation and Context

In order to make use of the format pictures returned for a locale by getLocaleInfoEx in the time package, it is necessary to bridge between the format pictures that the Windows API uses and the format strings that the time package uses.

Types of changes

Checklist:

Mistuke commented 4 years ago

Awesome! Thanks!