Exemplo n.º 1
0
 def set_value(self, time):
     if time is None:
         time = self.now_fn()
     self.date_picker.SetGregorianDate(GregorianDateTime.from_time(time).to_date_tuple())
     self.time_picker.SetGregorianTime(GregorianDateTime.from_time(time).to_time_tuple())
     if self.on_change is not None:
         self.on_change()
Exemplo n.º 2
0
 def navigate(tp):
     start = GregorianDateTime.from_time(curret_period.start_time)
     end = GregorianDateTime.from_time(curret_period.end_time)
     start_months = start.year * 12 + start.month
     end_months = end.year * 12 + end.month
     month_diff = end_months - start_months
     month_delta = month_diff * direction
     new_start_year, new_start_month = _months_to_year_and_month(
         start_months + month_delta)
     new_end_year, new_end_month = _months_to_year_and_month(end_months +
                                                             month_delta)
     try:
         new_start = start.replace(year=new_start_year,
                                   month=new_start_month)
         new_end = end.replace(year=new_end_year, month=new_end_month)
         start = new_start.to_time()
         end = new_end.to_time()
         if end > GregorianTimeType().get_max_time():
             raise ValueError()
         if start < GregorianTimeType().get_min_time():
             raise ValueError()
     except ValueError:
         if direction < 0:
             raise TimeOutOfRangeLeftError()
         else:
             raise TimeOutOfRangeRightError()
     return tp.update(start, end)
Exemplo n.º 3
0
 def time_to_wx_date(self, time):
     year, month, day = GregorianDateTime.from_time(time).to_date_tuple()
     try:
         return wx.DateTimeFromDMY(day, month - 1, year, 0, 0, 0)
     except OverflowError:
         if year < 0:
             year, month, day = GregorianDateTime.from_time(GregorianTime(0, 0)).to_date_tuple()
             return wx.DateTimeFromDMY(day, month - 1, year, 0, 0, 0)
Exemplo n.º 4
0
 def time_to_wx_date(self, time):
     year, month, day = GregorianDateTime.from_time(time).to_date_tuple()
     try:
         return wx.DateTimeFromDMY(day, month - 1, year, 0, 0, 0)
     except OverflowError:
         if year < 0:
             year, month, day = GregorianDateTime.from_time(
                 GregorianTime(0, 0)).to_date_tuple()
             return wx.DateTimeFromDMY(day, month - 1, year, 0, 0, 0)
Exemplo n.º 5
0
 def _assert_period_is_valid(self, new_start, new_end):
     if new_start is None:
         raise ValueError(_("Invalid start time"))
     if new_end is None:
         raise ValueError(_("Invalid end time"))
     if new_start > new_end:
         raise ValueError(_("Start time can't be after end time. Start:%s End:%s" %
                            (GregorianDateTime.from_time(new_start),
                             GregorianDateTime.from_time(new_end))))
Exemplo n.º 6
0
 def set_value(self, time):
     if time is None:
         time = self.now_fn()
     self.date_picker.SetGregorianDate(
         GregorianDateTime.from_time(time).to_date_tuple())
     self.time_picker.SetGregorianTime(
         GregorianDateTime.from_time(time).to_time_tuple())
     if self.on_change is not None:
         self.on_change()
Exemplo n.º 7
0
 def label(self, time, major=False):
     day_of_week = GregorianTimeType().get_day_of_week(time)
     if major:
         time = GregorianDateTime.from_time(time)
         return "%s %s %s %s" % (
             abbreviated_name_of_weekday(day_of_week), time.day,
             abbreviated_name_of_month(time.month), format_year(time.year))
     return (abbreviated_name_of_weekday(day_of_week) +
             " %s" % GregorianDateTime.from_time(time).day)
Exemplo n.º 8
0
 def label(self, time, major=False):
     day_of_week = GregorianTimeType().get_day_of_week(time)
     if major:
         time = GregorianDateTime.from_time(time)
         return "%s %s %s %s" % (abbreviated_name_of_weekday(day_of_week),
                                 time.day,
                                 abbreviated_name_of_month(time.month),
                                 format_year(time.year))
     return (abbreviated_name_of_weekday(day_of_week) +
             " %s" % GregorianDateTime.from_time(time).day)
Exemplo n.º 9
0
 def _assert_period_is_valid(self, new_start, new_end):
     if new_start is None:
         raise ValueError(_("Invalid start time"))
     if new_end is None:
         raise ValueError(_("Invalid end time"))
     if new_start > new_end:
         raise ValueError(
             _("Start time can't be after end time. Start:%s End:%s" %
               (GregorianDateTime.from_time(new_start),
                GregorianDateTime.from_time(new_end))))
Exemplo n.º 10
0
def move_period_num_years(period, num):
    try:
        delta = num
        start_year = GregorianDateTime.from_time(period.start_time).year
        end_year = GregorianDateTime.from_time(period.end_time).year
        start_time = GregorianDateTime.from_time(period.start_time).replace(year=start_year + delta)
        end_time = GregorianDateTime.from_time(period.end_time).replace(year=end_year + delta)
        return TimePeriod(start_time.to_time(), end_time.to_time())
    except ValueError:
        return None
Exemplo n.º 11
0
def move_period_num_years(period, num):
    try:
        delta = num
        start_year = GregorianDateTime.from_time(period.start_time).year
        end_year = GregorianDateTime.from_time(period.end_time).year
        start_time = GregorianDateTime.from_time(period.start_time).replace(year=start_year + delta)
        end_time = GregorianDateTime.from_time(period.end_time).replace(year=end_year + delta)
        return TimePeriod(start_time.to_time(), end_time.to_time())
    except ValueError:
        return None
Exemplo n.º 12
0
 def _time_range_string(self, start, end):
     start = GregorianDateTime.from_time(start)
     end = GregorianDateTime.from_time(end)
     if start.year == end.year:
         if start.month == end.month:
             return "%s-%s %s %s" % (start.day, end.day,
                                     abbreviated_name_of_month(start.month),
                                     format_year(start.year))
         return "%s %s-%s %s %s" % (
             start.day, abbreviated_name_of_month(start.month), end.day,
             abbreviated_name_of_month(end.month), format_year(start.year))
     return "%s %s %s-%s %s %s" % (
         start.day, abbreviated_name_of_month(
             start.month), format_year(start.year), end.day,
         abbreviated_name_of_month(end.month), format_year(end.year))
Exemplo n.º 13
0
 def label(self, time, major=False):
     time = GregorianDateTime.from_time(time)
     if major:
         return "%s %s %s" % (time.day,
                              abbreviated_name_of_month(time.month),
                              format_year(time.year))
     return str(time.day)
Exemplo n.º 14
0
 def label_without_time(time):
     gregorian_datetime = GregorianDateTime.from_time(time)
     return "%s %s %s" % (
         gregorian_datetime.day,
         abbreviated_name_of_month(gregorian_datetime.month),
         format_year(gregorian_datetime.year)
     )
Exemplo n.º 15
0
 def start(self, time):
     gregorian_time = GregorianDateTime.from_time(time)
     return GregorianDateTime.from_ymd(
         gregorian_time.year,
         gregorian_time.month,
         gregorian_time.day
     ).to_time()
Exemplo n.º 16
0
 def label(self, time, major=False):
     time = GregorianDateTime.from_time(time)
     if major:
         return "%s %s %s: %s:%s" % (
             time.day, abbreviated_name_of_month(time.month),
             format_year(time.year), time.hour, time.minute)
     return str(time.minute)
Exemplo n.º 17
0
Arquivo: date.py Projeto: ncqgm/gnumed
 def decrement_month(self, date):
     year, month, day = date
     if month > 1:
         return self._set_valid_day(year, month - 1, day)
     elif year > GregorianDateTime.from_time(GregorianTimeType().get_min_time()).year:
         return self._set_valid_day(year - 1, 12, day)
     return date
Exemplo n.º 18
0
 def increment_year(self, date):
     max_year = GregorianDateTime.from_time(
         GregorianTimeType().get_max_time()).year
     year, month, day = date
     if year < max_year - 1:
         return self._set_valid_day(year + 1, month, day)
     return date
Exemplo n.º 19
0
 def start(self, time):
     gregorian_time = GregorianDateTime.from_time(time)
     return GregorianDateTime.from_ymd(
         gregorian_time.year,
         gregorian_time.month,
         gregorian_time.day
     ).to_time()
Exemplo n.º 20
0
 def label_without_time(time):
     gregorian_datetime = GregorianDateTime.from_time(time)
     return u"%s %s %s" % (
         gregorian_datetime.day,
         abbreviated_name_of_month(gregorian_datetime.month),
         format_year(gregorian_datetime.year)
     )
Exemplo n.º 21
0
Arquivo: date.py Projeto: ncqgm/gnumed
 def increment_month(self, date):
     max_year = GregorianDateTime.from_time(GregorianTimeType().get_max_time()).year
     year, month, day = date
     if month < 12:
         return self._set_valid_day(year, month + 1, day)
     elif year < max_year - 1:
         return self._set_valid_day(year + 1, 1, day)
     return date
Exemplo n.º 22
0
 def increment_day(self, date):
     year, month, day = date
     time = GregorianDateTime.from_ymd(year, month, day).to_time()
     if time < GregorianTimeType().get_max_time(
     ) - GregorianDelta.from_days(1):
         return GregorianDateTime.from_time(
             time + GregorianDelta.from_days(1)).to_date_tuple()
     return date
Exemplo n.º 23
0
 def decrement_month(self, date):
     year, month, day = date
     if month > 1:
         return self._set_valid_day(year, month - 1, day)
     elif year > GregorianDateTime.from_time(
             GregorianTimeType().get_min_time()).year:
         return self._set_valid_day(year - 1, 12, day)
     return date
Exemplo n.º 24
0
def fit_millennium_fn(main_frame, current_period, navigation_fn):
    mean = GregorianDateTime.from_time(current_period.mean_time())
    if mean.year > get_millenium_max_year():
        year = get_millenium_max_year()
    else:
        year = max(get_min_year_containing_jan_1(), int(mean.year / 1000) * 1000)
    start = GregorianDateTime.from_ymd(year, 1, 1).to_time()
    end = GregorianDateTime.from_ymd(year + 1000, 1, 1).to_time()
    navigation_fn(lambda tp: tp.update(start, end))
Exemplo n.º 25
0
 def label(self, time, major=False):
     if major:
         gregorian_time = GregorianDateTime.from_time(time)
         return self._format_century(
             self._century_number(
                 self._century_start_year(gregorian_time.year)),
             gregorian_time.is_bc())
     else:
         return ""
Exemplo n.º 26
0
def fit_week_fn(main_frame, current_period, navigation_fn):
    mean = GregorianDateTime.from_time(current_period.mean_time())
    start = GregorianDateTime.from_ymd(mean.year, mean.month, mean.day).to_time()
    weekday = GregorianTimeType().get_day_of_week(start)
    start = start - GregorianDelta.from_days(weekday)
    if not main_frame.week_starts_on_monday():
        start = start - GregorianDelta.from_days(1)
    end = start + GregorianDelta.from_days(7)
    navigation_fn(lambda tp: tp.update(start, end))
Exemplo n.º 27
0
def fit_millennium_fn(main_frame, current_period, navigation_fn):
    mean = GregorianDateTime.from_time(current_period.mean_time())
    if mean.year > get_millenium_max_year():
        year = get_millenium_max_year()
    else:
        year = max(get_min_year_containing_jan_1(), int(mean.year // 1000) * 1000)
    start = GregorianDateTime.from_ymd(year, 1, 1).to_time()
    end = GregorianDateTime.from_ymd(year + 1000, 1, 1).to_time()
    navigation_fn(lambda tp: tp.update(start, end))
Exemplo n.º 28
0
def fit_week_fn(main_frame, current_period, navigation_fn):
    mean = GregorianDateTime.from_time(current_period.mean_time())
    start = GregorianDateTime.from_ymd(mean.year, mean.month, mean.day).to_time()
    weekday = GregorianTimeType().get_day_of_week(start)
    start = start - GregorianDelta.from_days(weekday)
    if not main_frame.week_starts_on_monday():
        start = start - GregorianDelta.from_days(1)
    end = start + GregorianDelta.from_days(7)
    navigation_fn(lambda tp: tp.update(start, end))
Exemplo n.º 29
0
def _whole_number_of_years(period):
    """
    >>> from timelinelib.test.utils import gregorian_period

    >>> _whole_number_of_years(gregorian_period("1 Jan 2013", "1 Jan 2014"))
    True

    >>> _whole_number_of_years(gregorian_period("1 Jan 2013", "1 Jan 2015"))
    True

    >>> _whole_number_of_years(gregorian_period("1 Feb 2013", "1 Feb 2014"))
    False

    >>> _whole_number_of_years(gregorian_period("1 Jan 2013", "1 Feb 2014"))
    False
    """
    return (GregorianDateTime.from_time(period.start_time).is_first_day_in_year() and
            GregorianDateTime.from_time(period.end_time).is_first_day_in_year() and
            _calculate_year_diff(period) > 0)
Exemplo n.º 30
0
 def navigate(tp):
     year_delta = direction * _calculate_year_diff(curret_period)
     gregorian_start = GregorianDateTime.from_time(curret_period.start_time)
     gregorian_end = GregorianDateTime.from_time(curret_period.end_time)
     new_start_year = gregorian_start.year + year_delta
     new_end_year = gregorian_end.year + year_delta
     try:
         new_start = gregorian_start.replace(year=new_start_year).to_time()
         new_end = gregorian_end.replace(year=new_end_year).to_time()
         if new_end > GregorianTimeType().get_max_time():
             raise ValueError()
         if new_start < GregorianTimeType().get_min_time():
             raise ValueError()
     except ValueError:
         if direction < 0:
             raise TimeOutOfRangeLeftError()
         else:
             raise TimeOutOfRangeRightError()
     return tp.update(new_start, new_end)
Exemplo n.º 31
0
def _whole_number_of_years(period):
    """
    >>> from timelinelib.test.utils import gregorian_period

    >>> _whole_number_of_years(gregorian_period("1 Jan 2013", "1 Jan 2014"))
    True

    >>> _whole_number_of_years(gregorian_period("1 Jan 2013", "1 Jan 2015"))
    True

    >>> _whole_number_of_years(gregorian_period("1 Feb 2013", "1 Feb 2014"))
    False

    >>> _whole_number_of_years(gregorian_period("1 Jan 2013", "1 Feb 2014"))
    False
    """
    return (GregorianDateTime.from_time(period.start_time).is_first_day_in_year() and
            GregorianDateTime.from_time(period.end_time).is_first_day_in_year() and
            _calculate_year_diff(period) > 0)
Exemplo n.º 32
0
 def _time_range_string(self, start, end):
     start = GregorianDateTime.from_time(start)
     end = GregorianDateTime.from_time(end)
     if start.year == end.year:
         if start.month == end.month:
             return "%s-%s %s %s" % (start.day, end.day,
                                     abbreviated_name_of_month(start.month),
                                     format_year(start.year))
         return "%s %s-%s %s %s" % (start.day,
                                    abbreviated_name_of_month(start.month),
                                    end.day,
                                    abbreviated_name_of_month(end.month),
                                    format_year(start.year))
     return "%s %s %s-%s %s %s" % (start.day,
                                   abbreviated_name_of_month(start.month),
                                   format_year(start.year),
                                   end.day,
                                   abbreviated_name_of_month(end.month),
                                   format_year(end.year))
Exemplo n.º 33
0
 def navigate(tp):
     year_delta = direction * _calculate_year_diff(curret_period)
     gregorian_start = GregorianDateTime.from_time(curret_period.start_time)
     gregorian_end = GregorianDateTime.from_time(curret_period.end_time)
     new_start_year = gregorian_start.year + year_delta
     new_end_year = gregorian_end.year + year_delta
     try:
         new_start = gregorian_start.replace(year=new_start_year).to_time()
         new_end = gregorian_end.replace(year=new_end_year).to_time()
         if new_end > GregorianTimeType().get_max_time():
             raise ValueError()
         if new_start < GregorianTimeType().get_min_time():
             raise ValueError()
     except ValueError:
         if direction < 0:
             raise TimeOutOfRangeLeftError()
         else:
             raise TimeOutOfRangeRightError()
     return tp.update(new_start, new_end)
Exemplo n.º 34
0
 def move_time(time):
     gregorian_time = GregorianDateTime.from_time(time)
     new_month = gregorian_time.month + num
     new_year = gregorian_time.year
     while new_month < 1:
         new_month += 12
         new_year -= 1
     while new_month > 12:
         new_month -= 12
         new_year += 1
     return gregorian_time.replace(year=new_year, month=new_month).to_time()
Exemplo n.º 35
0
 def move_time(time):
     gregorian_time = GregorianDateTime.from_time(time)
     new_month = gregorian_time.month + num
     new_year = gregorian_time.year
     while new_month < 1:
         new_month += 12
         new_year -= 1
     while new_month > 12:
         new_month -= 12
         new_year += 1
     return gregorian_time.replace(year=new_year, month=new_month).to_time()
Exemplo n.º 36
0
 def label(self, time, major=False):
     if major:
         gregorian_time = GregorianDateTime.from_time(time)
         return self._format_century(
             self._century_number(
                 self._century_start_year(gregorian_time.year)
             ),
             gregorian_time.is_bc()
         )
     else:
         return ""
Exemplo n.º 37
0
 def get_start_end(self):
     now = GregorianDateTime.from_time(self.db.time_type.now())
     start = GregorianDateTime(
         now.year,
         now.month,
         1,
         0,
         0,
         0
     ).to_time()
     end = start + self.get_delta(30)
     return (start, end)
Exemplo n.º 38
0
def _whole_number_of_months(period):
    """
    >>> from timelinelib.test.utils import gregorian_period

    >>> _whole_number_of_months(gregorian_period("1 Jan 2013", "1 Jan 2014"))
    True

    >>> _whole_number_of_months(gregorian_period("1 Jan 2013", "1 Mar 2014"))
    True

    >>> _whole_number_of_months(gregorian_period("2 Jan 2013", "2 Mar 2014"))
    False

    >>> _whole_number_of_months(gregorian_period("1 Jan 2013 12:00", "1 Mar 2014"))
    False
    """
    start, end = GregorianDateTime.from_time(period.start_time), GregorianDateTime.from_time(period.end_time)
    start_months = start.year * 12 + start.month
    end_months = end.year * 12 + end.month
    month_diff = end_months - start_months
    return (start.is_first_of_month() and
            end.is_first_of_month() and
            month_diff > 0)
Exemplo n.º 39
0
 def label(self, time, major=False):
     if major:
         first_weekday = self.start(time)
         next_first_weekday = self.increment(first_weekday)
         last_weekday = next_first_weekday - GregorianDelta.from_days(1)
         range_string = self._time_range_string(first_weekday, last_weekday)
         if self.appearance.get_week_start() == "monday":
             return (_("Week") + " %s (%s)") % (GregorianDateTime.from_time(
                 time).week_number, range_string)
         else:
             # It is sunday (don't know what to do about week numbers here)
             return range_string
     # This strip should never be used as minor
     return ""
Exemplo n.º 40
0
def _whole_number_of_months(period):
    """
    >>> from timelinelib.test.utils import gregorian_period

    >>> _whole_number_of_months(gregorian_period("1 Jan 2013", "1 Jan 2014"))
    True

    >>> _whole_number_of_months(gregorian_period("1 Jan 2013", "1 Mar 2014"))
    True

    >>> _whole_number_of_months(gregorian_period("2 Jan 2013", "2 Mar 2014"))
    False

    >>> _whole_number_of_months(gregorian_period("1 Jan 2013 12:00", "1 Mar 2014"))
    False
    """
    start, end = GregorianDateTime.from_time(
        period.start_time), GregorianDateTime.from_time(period.end_time)
    start_months = start.year * 12 + start.month
    end_months = end.year * 12 + end.month
    month_diff = end_months - start_months
    return (start.is_first_of_month() and end.is_first_of_month()
            and month_diff > 0)
Exemplo n.º 41
0
 def navigate(tp):
     start = GregorianDateTime.from_time(curret_period.start_time)
     end = GregorianDateTime.from_time(curret_period.end_time)
     start_months = start.year * 12 + start.month
     end_months = end.year * 12 + end.month
     month_diff = end_months - start_months
     month_delta = month_diff * direction
     new_start_year, new_start_month = _months_to_year_and_month(start_months + month_delta)
     new_end_year, new_end_month = _months_to_year_and_month(end_months + month_delta)
     try:
         new_start = start.replace(year=new_start_year, month=new_start_month)
         new_end = end.replace(year=new_end_year, month=new_end_month)
         start = new_start.to_time()
         end = new_end.to_time()
         if end > GregorianTimeType().get_max_time():
             raise ValueError()
         if start < GregorianTimeType().get_min_time():
             raise ValueError()
     except ValueError:
         if direction < 0:
             raise TimeOutOfRangeLeftError()
         else:
             raise TimeOutOfRangeRightError()
     return tp.update(start, end)
Exemplo n.º 42
0
 def label(self, time, major=False):
     if major:
         first_weekday = self.start(time)
         next_first_weekday = self.increment(first_weekday)
         last_weekday = next_first_weekday - GregorianDelta.from_days(1)
         range_string = self._time_range_string(first_weekday, last_weekday)
         if self.appearance.get_week_start() == "monday":
             return (_("Week") + " %s (%s)") % (
                 GregorianDateTime.from_time(time).week_number,
                 range_string
             )
         else:
             # It is sunday (don't know what to do about week numbers here)
             return range_string
     # This strip should never be used as minor
     return ""
Exemplo n.º 43
0
def navigate_month_step(current_period, navigation_fn, direction):
    """
    Currently does notice leap years.
    """
    # TODO: NEW-TIME: (year, month, day, hour, minute, second) -> int (days in # month)
    tm = current_period.mean_time()
    gt = GregorianDateTime.from_time(tm)
    if direction > 0:
        if gt.month == 2:
            d = 28
        elif gt.month in (4, 6, 9, 11):
            d = 30
        else:
            d = 31
    else:
        if gt.month == 3:
            d = 28
        elif gt.month in (5, 7, 10, 12):
            d = 30
        else:
            d = 31
    mv = GregorianDelta.from_days(d)
    navigation_fn(lambda tp: tp.move_delta(direction * mv))
Exemplo n.º 44
0
def navigate_month_step(current_period, navigation_fn, direction):
    """
    Currently does notice leap years.
    """
    # TODO: NEW-TIME: (year, month, day, hour, minute, second) -> int (days in # month)
    tm = current_period.mean_time()
    gt = GregorianDateTime.from_time(tm)
    if direction > 0:
        if gt.month == 2:
            d = 28
        elif gt.month in (4, 6, 9, 11):
            d = 30
        else:
            d = 31
    else:
        if gt.month == 3:
            d = 28
        elif gt.month in (5, 7, 10, 12):
            d = 30
        else:
            d = 31
    mv = GregorianDelta.from_days(d)
    navigation_fn(lambda tp: tp.move_delta(direction * mv))
Exemplo n.º 45
0
 def label(self, time, major=False):
     time = GregorianDateTime.from_time(time)
     if major:
         return "%s %s" % (abbreviated_name_of_month(
             time.month), format_year(time.year))
     return abbreviated_name_of_month(time.month)
Exemplo n.º 46
0
 def increment(self, time):
     return time + GregorianDelta.from_days(
         GregorianDateTime.from_time(time).days_in_month()
     )
Exemplo n.º 47
0
 def increment(self, time):
     gregorian_time = GregorianDateTime.from_time(time)
     return gregorian_time.replace(year=gregorian_time.year + 1).to_time()
Exemplo n.º 48
0
 def start(self, time):
     gregorian_time = GregorianDateTime.from_time(time)
     new_gregorian = GregorianDateTime.from_ymd(gregorian_time.year, 1, 1)
     return new_gregorian.to_time()
Exemplo n.º 49
0
 def label(self, time, major=False):
     return format_year(GregorianDateTime.from_time(time).year)
Exemplo n.º 50
0
 def increment(self, time):
     gregorian_time = GregorianDateTime.from_time(time)
     return gregorian_time.replace(
         year=self._next_decacde_start_year(gregorian_time.year)
     ).to_time()
Exemplo n.º 51
0
 def start(self, time):
     gregorian_time = GregorianDateTime.from_time(time)
     new_gregorian = GregorianDateTime.from_ymd(gregorian_time.year, 1, 1)
     return new_gregorian.to_time()
Exemplo n.º 52
0
 def time_string(self, time):
     return "%d-%02d-%02d %02d:%02d:%02d" % GregorianDateTime.from_time(time).to_tuple()
Exemplo n.º 53
0
 def label(self, time, major=False):
     return format_year(GregorianDateTime.from_time(time).year)
Exemplo n.º 54
0
 def start(self, time):
     return GregorianDateTime.from_ymd(
         self._decade_start_year(GregorianDateTime.from_time(time).year), 1,
         1).to_time()
Exemplo n.º 55
0
 def increment(self, time):
     gregorian_time = GregorianDateTime.from_time(time)
     return gregorian_time.replace(year=gregorian_time.year + 1).to_time()
Exemplo n.º 56
0
 def label(self, time, major=False):
     gregorian_time = GregorianDateTime.from_time(time)
     return self._format_decade(
         self._decade_number(self._decade_start_year(gregorian_time.year)),
         gregorian_time.is_bc()
     )
Exemplo n.º 57
0
 def label(self, time, major=False):
     gregorian_time = GregorianDateTime.from_time(time)
     return self._format_decade(
         self._decade_number(self._decade_start_year(gregorian_time.year)),
         gregorian_time.is_bc())
Exemplo n.º 58
0
 def start(self, time):
     return GregorianDateTime.from_ymd(
         self._decade_start_year(GregorianDateTime.from_time(time).year),
         1,
         1
     ).to_time()
Exemplo n.º 59
0
 def increment(self, time):
     return time + GregorianDelta.from_days(
         GregorianDateTime.from_time(time).days_in_month())
Exemplo n.º 60
0
 def increment(self, time):
     gregorian_time = GregorianDateTime.from_time(time)
     return gregorian_time.replace(
         year=self._next_decacde_start_year(gregorian_time.year)).to_time()