B
    ª0H[ä
  ã            	   @   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	 de	ddƒfde	d	d
ƒfde	ddƒfde	ddƒfde	ddƒfde	ddƒffZ
ddd„Zddd„ZdS )é    N)Úavoid_wrapping)Úis_awareÚutc)ÚgettextÚngettext_lazyi€3áz%d yearz%d yearsi �' z%d monthz	%d monthsi€:	 z%d weekz%d weeksi€Q z%d dayz%d daysi  z%d hourz%d hoursé<   z	%d minutez
%d minutesFc             C   s‚  t | tjƒs t | j| j| j¡} |rDt |tjƒsDt |j|j|j¡}|s`tj t| ƒrZtnd¡}|rn||  } }||  }t 	| j|j¡}|dkr¸t 
| j¡r¤|d8 }nt 
|j¡r¸|d7 }|t |¡8 }|jd d d |j }|dkròttdƒƒS x*ttƒD ]\}\}}|| }	|	dkrüP qüW t||	 ƒ}
|d ttƒk �r~t|d  \}}|||	  | }|dk�r~|
tdƒt|| ƒ 7 }
|
S )aJ  
    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.

    Adapted from
    http://web.archive.org/web/20060617175230/http://blog.natbat.co.uk/archive/2003/Jun/14/time_since
    Nr   é   é   r   z	0 minutesz, )Ú
isinstanceÚdatetimeÚyearÚmonthÚdayÚnowr   r   ÚcalendarÚleapdaysÚisleapÚ	timedeltaÚdaysÚsecondsr   r   Ú	enumerateÚTIMESINCE_CHUNKSÚlen)Údr   ÚreversedÚdeltar   ZsinceÚir   ÚnameÚcountÚresultZseconds2Zname2Zcount2© r    úZC:\Users\HIRONO~1\AppData\Local\Temp\pip-install-6bm3nxem\django\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!   Ú	timeuntilI   s    r#   )NF)N)r   r   Zdjango.utils.htmlr   Zdjango.utils.timezoner   r   Zdjango.utils.translationr   r   r   r"   r#   r    r    r    r!   Ú<module>   s   
7