示例#1
0
def display_date(start, end):
    """ Formates the date range given for display. """

    timezone = settings().timezone()

    start = sedate.to_timezone(start, timezone)
    end = sedate.to_timezone(end, timezone)

    if end.microsecond != 999999:
        end -= timedelta(microseconds=1)

    if (start, end) == align_range_to_day(start, end):
        if start.date() == end.date():
            return localize_date(start, long_format=False)
        else:
            return ' - '.join((localize_date(start, long_format=False),
                               localize_date(end, long_format=False)))

    end += timedelta(microseconds=1)

    if start.date() == end.date():
        return ' - '.join(
            (localize_date(start,
                           long_format=True), localize_date(end,
                                                            time_only=True)))
    else:
        return ' - '.join((localize_date(start, long_format=True),
                           localize_date(end, long_format=True)))
示例#2
0
def display_date(start, end):
    """ Formates the date range given for display. """

    timezone = settings().timezone()

    start = sedate.to_timezone(start, timezone)
    end = sedate.to_timezone(end, timezone)

    if end.microsecond != 999999:
        end -= timedelta(microseconds=1)

    if (start, end) == align_range_to_day(start, end):
        if start.date() == end.date():
            return localize_date(start, long_format=False)
        else:
            return ' - '.join((
                localize_date(start, long_format=False),
                localize_date(end, long_format=False)
            ))

    end += timedelta(microseconds=1)

    if start.date() == end.date():
        return ' - '.join((
            localize_date(start, long_format=True),
            localize_date(end, time_only=True)
        ))
    else:
        return ' - '.join((
            localize_date(start, long_format=True),
            localize_date(end, long_format=True)
        ))
示例#3
0
def event_class(availability):
    """Returns the event class to be used depending on the availability."""

    s = settings()

    available = s.get('available_threshold')
    partly = s.get('partly_available_threshold')

    if availability >= available:
        return 'event-available'
    elif partly <= availability and availability < available:
        return 'event-partly-available'
    else:
        return 'event-unavailable'
示例#4
0
def event_class(availability):
    """Returns the event class to be used depending on the availability."""

    s = settings()

    available = s.get('available_threshold')
    partly = s.get('partly_available_threshold')

    if availability >= available:
        return 'event-available'
    elif partly <= availability and availability < available:
        return 'event-partly-available'
    else:
        return 'event-unavailable'