betty.locale.date module - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.locale.date module

Localize dates.

class betty.locale.date.Date

  Bases: `LinkedDataDumpable`[`Object`]

  A (Gregorian) date.

  __init__(year: int | None = None, month: int | None = None, day: int | None = None, fuzzy: bool = False)
  property comparable: bool

    If this date is comparable to other dateys.

  property complete: bool

    Whether this date is complete.

  day: int | None
  async dump_linked_data(project: Project, context_definition: str | None = None) → DumpMapping[Dump]

    Dump this instance to JSON-LD.

  fuzzy: bool
  async classmethod linked_data_schema(project: Project) → DateSchema

    Define the JSON Schema for `betty.json.linked_data.LinkedDataDumpable.dump_linked_data()`.

  month: int | None
  property parts: tuple[int | None, int | None, int | None]

    The date parts: a 3-tuple of the year, month, and day.

  to_range() → DateRange

    Convert this date to a date range.

  year: int | None

class betty.locale.date.DateRange

  Bases: `LinkedDataDumpable`[`Object`]

  A date range can describe a period of time between, before, after, or around start and/or end dates.

  __init__(start: Date | None = None, end: Date | None = None, start_is_boundary: bool = False, end_is_boundary: bool = False)
  property comparable: bool

    If this date is comparable to other dateys.

  async dump_linked_data(project: Project, start_context_definition: str | None = None, end_context_definition: str | None = None) → DumpMapping[Dump]

    Dump this instance to JSON-LD.

  end: Date | None
  end_is_boundary: bool
  async classmethod linked_data_schema(project: Project) → DateRangeSchema

    Define the JSON Schema for `betty.json.linked_data.LinkedDataDumpable.dump_linked_data()`.

  start: Date | None
  start_is_boundary: bool

class betty.locale.date.DateRangeSchema

  Bases: `Object`

  A JSON Schema for `betty.locale.date.DateRange`.

  __init__()

class betty.locale.date.DateSchema

  Bases: `JsonLdObject`

  A JSON Schema for `betty.locale.date.Date`.

  __init__(*, title: str = 'Date')

class betty.locale.date.DateySchema

  Bases: `OneOf`

  A JSON Schema for `betty.locale.date.Datey`.

  __init__()

exception betty.locale.date.IncompleteDateError

  Bases: `ValueError`

  Raised when a datey was unexpectedly incomplete.