geotribu_cli.utils.dates_manipulation module

Extract date from content path, location or name.

Author: Julien Moura (https://github.com/guts)

geotribu_cli.utils.dates_manipulation.get_date_from_content_location(input_content_location)

Extract date from content location string.

Paramètres:

input_content_location (str) – content location path.

Renvoie:

date object

Type renvoyé:

date

Example:

> sample_content_location = (
    "articles/2008/2008-08-22_1-introduction-a-l-api-google-maps/"
)
> sample_content_date = get_date_from_content_location(sample_content_location)
> print(type(sample_content_date), sample_content_date)
<class 'datetime.date'> 2008-08-22
geotribu_cli.utils.dates_manipulation.get_days_until_next_month(from_date=None)

Return the number of days until the next month.

Paramètres:

from_date (date) – date to compare to next month. If not set, datetime.date.today() is used.

Type renvoyé:

int

Renvoie:

number of days until next month

geotribu_cli.utils.dates_manipulation.is_more_recent(date_ref, date_to_compare)

Détermine si la date à comparer est plus récent que la date de référence.

Paramètres:
  • date_ref (date) – date de référence

  • date_to_compare (date) – date à comparer

Type renvoyé:

bool

Renvoie:

résultat de la comparaison