X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FLocale.hs;h=f2b21b7377ae58f32a6fde2c914f199740a2db68;hb=85f61fe85c3e314c1726199549e51fc30042f402;hp=e58335fda12a3c0335a97230136250e7b171ea2f;hpb=9fa9bc17072a58c0bae2cce4764d38677e96ac29;p=ghc-base.git diff --git a/System/Locale.hs b/System/Locale.hs index e58335f..f2b21b7 100644 --- a/System/Locale.hs +++ b/System/Locale.hs @@ -2,20 +2,22 @@ -- | -- Module : System.Locale -- Copyright : (c) The University of Glasgow 2001 --- License : BSD-style (see the file libraries/core/LICENSE) +-- License : BSD-style (see the file libraries/base/LICENSE) -- -- Maintainer : libraries@haskell.org --- Stability : provisional +-- Stability : stable -- Portability : portable -- --- $Id: Locale.hs,v 1.2 2002/04/24 16:31:45 simonmar Exp $ --- --- Operations for defining locale-specific date and time formats. +-- This module provides the ability to adapt to local conventions. +-- At present, it supports only time and date information as used by +-- 'System.Time.calendarTimeToString' from the "System.Time" module. -- ----------------------------------------------------------------------------- -module System.Locale - ( TimeLocale(..) +module System.Locale ( + + TimeLocale(..) + , defaultTimeLocale , iso8601DateFormat @@ -26,11 +28,15 @@ where import Prelude data TimeLocale = TimeLocale { - wDays :: [(String, String)], -- full and abbreviated week days - months :: [(String, String)], -- full and abbreviated months + -- |full and abbreviated week days + wDays :: [(String, String)], + -- |full and abbreviated months + months :: [(String, String)], intervals :: [(String, String)], - amPm :: (String, String), -- AM/PM symbols - dateTimeFmt, dateFmt, -- formatting strings + -- |AM\/PM symbols + amPm :: (String, String), + -- |formatting strings + dateTimeFmt, dateFmt, timeFmt, time12Fmt :: String } deriving (Eq, Ord, Show) @@ -65,11 +71,14 @@ defaultTimeLocale = TimeLocale { } +-- |Normally, ISO-8601 just defines YYYY-MM-DD +-- but we can add a time spec. + iso8601DateFormat :: Maybe String -> String iso8601DateFormat timeFmt = "%Y-%m-%d" ++ case timeFmt of - Nothing -> "" -- normally, ISO-8601 just defines YYYY-MM-DD - Just fmt -> ' ' : fmt -- but we can add a time spec + Nothing -> "" + Just fmt -> ' ' : fmt rfc822DateFormat :: String