darcs-2.14.3: a distributed, interactive, smart revision control system

Copyright 2003 Peter Simons2003 David Roundy GPL darcs-devel@darcs.net experimental portable None Haskell2010

Darcs.Util.IsoDate

Description

Synopsis

# Documentation

The current time in the format returned by showIsoDateTime

readUTCDate :: String -> CalendarTime Source #

Read/interpret a date string, assuming UTC if timezone is not specified in the string (see readDate) Warning! This errors out if we fail to interpret the date

readUTCDateOldFashioned :: String -> CalendarTime Source #

Similar to readUTCDate, except we ignore timezone info in the input string. This is incorrect and ugly. The only reason it still exists is so we can generate file names for old-fashioned repositories in the same way that old darcs versions expected them. You should not use this function except for the above stated purpose.

Parse a date string, assuming a default timezone if the date string does not specify one. The date formats understood are those of showIsoDateTime and dateTime

Return the local timezone offset from UTC in seconds

englishDateTime :: CalendarTime -> CharParser a CalendarTime Source #

In English, either a date followed by a time, or vice-versa, e.g,

• yesterday at noon
• yesterday tea time
• 12:00 yesterday

See englishDate and englishTime Uses its first argument as "now", i.e. the time relative to which "yesterday", "today" etc are to be interpreted

englishInterval :: CalendarTime -> CharParser a TimeInterval Source #

English expressions for intervals of time,

• before tea time (i.e. from the beginning of time)
• after 14:00 last month (i.e. till now)
• between last year and last month
• in the last three months (i.e. from then till now)
• 4 months ago (i.e. till now; see englishAgo)

englishLast :: CalendarTime -> CharParser a (CalendarTime, CalendarTime) Source #

Durations in English that begin with the word "last", E.g. "last 4 months" is treated as the duration between 4 months ago and now

iso8601Interval :: Int -> CharParser a (Either TimeDiff (MCalendarTime, MCalendarTime)) Source #

Intervals in ISO 8601, e.g.,

• 2008-09/2012-08-17T16:30
• 2008-09/P2Y11MT16H30M
• P2Y11MT16H30M/2012-08-17T16:30

See iso8601Duration

iso8601Duration :: CharParser a TimeDiff Source #

Durations in ISO 8601, e.g.,

• P4Y (four years)
• P5M (five months)
• P4Y5M (four years and five months)
• P4YT3H6S (four years, three hours and six seconds)

Convert a date string into ISO 8601 format (yyyymmdd variant) assuming local timezone if not specified in the string Warning! This errors out if we fail to interpret the date

resetCalendar :: CalendarTime -> CalendarTime Source #

Set a calendar to UTC time any eliminate any inconsistencies within (for example, where the weekday is given as Thursday, but this does not match what the numerical date would lead one to expect)

An MCalenderTime is an underspecified CalendarTime It is used for parsing dates. For example, if you want to parse the date '4 January', it may be useful to underspecify the year by setting it to Nothing. This uses almost the same fields as CalendarTime, a notable exception being that we introduce mctWeek to indicate if a weekday was specified or not

Constructors

 MCalendarTime FieldsmctYear :: Maybe Int mctMonth :: Maybe Month mctDay :: Maybe Int mctHour :: Maybe Int mctMin :: Maybe Int mctSec :: Maybe Int mctPicosec :: Maybe Integer mctWDay :: Maybe Day mctYDay :: Maybe Int mctTZName :: Maybe String mctTZ :: Maybe Int mctIsDST :: Maybe Bool mctWeek :: Bool
Instances
 Source # Instance detailsDefined in Darcs.Util.IsoDate MethodsshowList :: [MCalendarTime] -> ShowS #

toMCalendarTime :: CalendarTime -> MCalendarTime Source #

Trivially convert a CalendarTime to a fully specified MCalendarTime (note that this sets the mctWeek flag to False

unsafeToCalendarTime :: MCalendarTime -> CalendarTime Source #

Returns the first CalendarTime that falls within a MCalendarTime This is only unsafe in the sense that it plugs in default values for fields that have not been set, e.g. January for the month or 0 for the seconds field. Maybe we should rename it something happier. See also resetCalendar

unsetTime :: CalendarTime -> CalendarTime Source #

Zero the time fields of a CalendarTime

type TimeInterval = (Maybe CalendarTime, Maybe CalendarTime) Source #

showIsoDateTime :: CalendarTime -> String Source #

Display a CalendarTime in the ISO 8601 format without any separators, e.g. 20080825142503