Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
Find the first/last day of the week for the given day.
Assuming weeks start on Sunday and end on Saturday.

Returns a tuple of ``(start_date, end_date)``.

        def week_range(date):
    '''
    Find the first/last day of the week for the given day.
    Assuming weeks start on Sunday and end on Saturday.

    Returns a tuple of ``(start_date, end_date)``.
    '''
    # isocalendar calculates the year, week of the year, and day of the week.
    # dow is Mon = 1, Sat = 6, Sun = 7
    year, week, dow = date.isocalendar()

    # Find the first day of the week.
    if dow == 7:
        # Since we want to start with Sunday, let's test for that condition.
        start_date = date
    else:
        # Otherwise, subtract `dow` number days to get the first day
        start_date = date - timedelta(dow)

    # Now, add 6 for the last day of the week (i.e., count up to Saturday)
    end_date = start_date + timedelta(6)

    return (start_date, end_date)
        


src/h/o/horas-HEAD/apps/profiles/models.py   horas(Download)
from taggit.managers import TaggableManager
 
from .utils import get_gravatar_url, next_weekday, week_range
from .fields import DaysOfWeekField
 
            default_tz = get_default_timezone()
            next_slot = next_slot_local.astimezone(default_tz)
            week = week_range(next_slot)
 
            # Getto get_or_create