dk.ttcal package¶
Submodules¶
dk.ttcal.calfns module¶
dk.ttcal.day module¶
Date (single day) operations.
-
class
dk.ttcal.day.Day[source]¶ Bases:
datetime.dateA calendar date.
-
Month¶ Return a Month object representing the month self belongs to.
-
Year¶ Return a Year object representing the year self belongs to.
-
code¶ One letter code representing the dayname.
-
compare(other)[source]¶ Return how similar self is to other, i.e. the smallest factor they have in common (‘day’, ‘month’, or ‘year’). Returns None if the Days are in different years.
-
day_code= ['M', 'U', 'W', 'H', 'F', 'A', 'S']¶
-
day_name= [u'mandag', u'tirsdag', u'onsdag', u'torsdag', u'fredag', u'l\xf8rdag', u's\xf8ndag']¶
-
dayname¶ The semi-localized name of self.
-
display¶ Return the ‘class’ of self.
-
first¶ Define self == self.first for polymorphic usage with other classes.
-
idtag¶ Return the idtag for self: dyyyymmddmm.
-
in_month¶ True iff the day is in its month.
-
isoyear¶ Return the isoyear of self.
-
last¶ Define self == self.last for polymorphic usage with other classes.
-
middle¶ Return the day that splits the date range in half.
-
classmethod
parse(strval)[source]¶ Parse date value from a string. Allowed syntax include
yyyy-mm-dd, yyyy-m-dd, yyyy-mm-d, yyyy-m-d dd-mm-yyyy, etc. dd/mm/yyyy, ... dd.mm.yyyy, ... ddmmyyyy
-
special¶ True if the database has an entry for this date (sets special_hours).
-
today¶ True if self is today.
-
week¶ Return a Week object representing the week self belongs to.
-
weekday¶ True if self is a weekday.
-
weekend¶ True if self is Saturday or Sunday.
-
weeknum¶ Return the isoweek of self.
-
-
class
dk.ttcal.day.Days(start, end, start_week=False)[source]¶ Bases:
listA contigous set of days.
-
first¶ 1st day
-
last¶ last day
-
middle¶ Return the day that splits the date range in half.
-
-
class
dk.ttcal.day.Today[source]¶ Bases:
dk.ttcal.day.DaySpecial subclass for today’s date.
-
today= True¶
-
dk.ttcal.duration module¶
Extension of datetime.timedelta.
-
class
dk.ttcal.duration.Duration[source]¶ Bases:
datetime.timedeltaA duration of time.
-
hrs¶ The number of hours in self.
-
mins¶ The number of minutes in self.
-
classmethod
parse(txt)[source]¶ Parse a textual representation into a Duration object. Format HHH:MM:SS.
-
secs¶ The number of seconds in self.
-
dk.ttcal.month module¶
-
class
dk.ttcal.month.Month(year=None, month=None, date=None)[source]¶ Bases:
objectA calendar month.
-
Month¶
-
Year¶ Return a Year object for the year-part of this month.
-
daycount¶ The number of days in this month (as an int).
-
first¶ First day in month.
-
format(fmt=None)[source]¶ Format according to format string. Default format is monthname, four-digit-year.
-
idtag()[source]¶ Return a text representation that is parsable by the from_idtag function (above), and is useable as part of an url.
-
last¶ Last day in month.
-
middle¶ Return the day that splits the date range in half.
-
month= None¶
-
month_name= ['', 'Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember']¶
-
year= None¶
-
dk.ttcal.week module¶
dk.ttcal.year module¶
-
class
dk.ttcal.year.Year(year=None)[source]¶ Bases:
object-
H1¶ First half of this year.
-
H2¶ Last half of this year.
-
Month¶ For orthogonality in the api.
-
Q1¶ 1st quarter.
-
Q2¶ 2nd quarter.
-
Q3¶ 3rd quarter.
-
Q4¶ 4th quarter.
-
Year¶
-
april¶
-
august¶
-
december¶
-
february¶
-
first¶ First day of first month.
-
format(fmt=None)[source]¶ Format according to format string. Default format is monthname, four-digit-year.
-
classmethod
from_idtag(tag)[source]¶ Year tags have the lower-case letter y + the four digit year, eg. y2008.
-
january¶
-
july¶
-
june¶
-
last¶ Last day of last month.
-
march¶
-
may¶
-
middle¶ Return the day that splits the date range in half.
-
november¶
-
october¶
-
september¶
-