U
    ai                     @   s   d dl Z d dlZd dlmZ d dlmZmZ d dlmZm	Z	 e	dde	dde	d	d
e	dde	dde	dddZ
dZdddZdddZdS )    N)avoid_wrapping)is_awareutc)gettextngettext_lazyz%d yearz%d yearsz%d monthz	%d monthsz%d weekz%d weeksz%d dayz%d daysz%d hourz%d hoursz	%d minutez
%d minutes)yearmonthweekdayhourminute))i3r   )i ' r   )i:	 r	   )iQ r
   )i  r   )<   r   Fc                 C   s  |dkrt }t| tjs,t| j| j| j} |rPt|tjsPt|j|j|j}|pjtjt| rftnd}|rz||  } }||  }t	
| j|j}|dkrt	| jr|d8 }nt	|jr|d7 }|t|8 }|jd d d |j }|dkr ttdS ttD ]&\}\}}	|| }
|
dkr q0qt||	 |
 }|d ttk rt|d  \}}|||
  | }|dkr|tdt|| |  7 }|S )a  
    Take two datetime objects and return the time between d and now as a nicely
    formatted string, e.g. "10 minutes". If d occurs after now, return
    "0 minutes".

    Units used are years, months, weeks, days, hours, and minutes.
    Seconds and microseconds are ignored.  Up to two adjacent units will be
    displayed.  For example, "2 weeks, 3 days" and "1 year, 3 months" are
    possible outputs, but "2 weeks, 3 hours" and "1 year, 5 days" are not.

    `time_strings` is an optional dict of strings to replace the default
    TIME_STRINGS dict.

    Adapted from
    https://web.archive.org/web/20060617175230/http://blog.natbat.co.uk/archive/2003/Jun/14/time_since
    Nr         r   z	0 minutesz, )TIME_STRINGS
isinstancedatetimer   r   r
   nowr   r   calendarleapdaysisleap	timedeltadayssecondsr   r   	enumerateTIMESINCE_CHUNKSlen)dr   reversedtime_stringsdeltar   Zsinceir   namecountresultZseconds2Zname2Zcount2 r%   /home/adriano.carvalho/ftp/files/BrinquedotecaVirtual/brinquedotecavirtual/venv/lib/python3.8/site-packages/django/utils/timesince.py	timesince   s>    





r'   c                 C   s   t | |d|dS )zV
    Like timesince, but return a string measuring the time until the given time.
    T)r   r   )r'   )r   r   r   r%   r%   r&   	timeuntilW   s    r(   )NFN)NN)r   r   Zdjango.utils.htmlr   Zdjango.utils.timezoner   r   Zdjango.utils.translationr   r   r   r   r'   r(   r%   r%   r%   r&   <module>   s   	

<