import time

import dateparser

from st2common.runners.base_action import Action


class ParseDateStringAction(Action):
    def run(self, date_string):
        dt = dateparser.parse(date_string)

        if not dt:
            raise ValueError('Failed to parse date string: %s' % (date_string))

        timestamp = int(time.mktime(dt.timetuple()))
        return timestamp

import time

import dateparser

from st2common.runners.base_action import Action


class ParseDateStringAction(Action):
    def run(self, date_string):
        dt = dateparser.parse(date_string)

        if not dt:
            raise ValueError('Failed to parse date string: %s' % (date_string))

        timestamp = int(time.mktime(dt.timetuple()))
        return timestamp
