How to use the dateparser.date function in dateparser

To help you get started, we’ve selected a few dateparser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scrapinghub / dateparser / tests / test_date.py View on Github external
def when_parser_is_initialized(self, languages=None, locales=None, region=None,
                                   try_previous_locales=True, use_given_order=False):
        try:
            self.parser = date.DateDataParser(
                languages=languages, locales=locales, region=region,
                try_previous_locales=try_previous_locales, use_given_order=use_given_order)
        except Exception as error:
            self.error = error
github scrapinghub / dateparser / tests / test_date.py View on Github external
def when_date_is_parsed_with_formats(self, date_string, date_formats):
        self.result = date.parse_with_formats(date_string, date_formats, settings)
github scrapinghub / dateparser / tests / test_date.py View on Github external
def when_intersecting_period_calculated(self, low, high, period_size):
        try:
            self.result = list(date.get_intersecting_periods(low, high, period=period_size))
        except Exception as error:
            self.error = error
github scrapinghub / dateparser / tests / test_date.py View on Github external
def when_date_range_generated(self, begin, end, **size):
        try:
            self.result = list(date.date_range(begin, end, **size))
        except Exception as error:
            self.error = error
github scrapinghub / dateparser / tests / test_date.py View on Github external
def test_sanitize_date_colons(self):
        self.assertEqual(date.sanitize_date(u'2019:'), u'2019')
        self.assertEqual(date.sanitize_date(u'31/07/2019:'), u'31/07/2019')
github scrapinghub / dateparser / tests / test_date.py View on Github external
def given_parser(self, language, date_string, date_formats, settings):
        self.parser = date._DateLocaleParser(language, date_string, date_formats, settings)