|
@@ -5,6 +5,7 @@ from __future__ import unicode_literals |
|
|
|
|
|
|
|
|
# IMPORTANT: only import safe functions as this module will be included in jinja environment |
|
|
# IMPORTANT: only import safe functions as this module will be included in jinja environment |
|
|
import frappe |
|
|
import frappe |
|
|
|
|
|
from dateutil.parser._parser import ParserError |
|
|
import subprocess |
|
|
import subprocess |
|
|
import operator |
|
|
import operator |
|
|
import re, datetime, math, time |
|
|
import re, datetime, math, time |
|
@@ -43,8 +44,12 @@ def getdate(string_date=None): |
|
|
|
|
|
|
|
|
if is_invalid_date_string(string_date): |
|
|
if is_invalid_date_string(string_date): |
|
|
return None |
|
|
return None |
|
|
|
|
|
|
|
|
return parser.parse(string_date).date() |
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
return parser.parse(string_date).date() |
|
|
|
|
|
except ParserError: |
|
|
|
|
|
frappe.throw(frappe._('{} is not a valid date string.').format( |
|
|
|
|
|
frappe.bold(string_date) |
|
|
|
|
|
), title=frappe._('Invalid Date')) |
|
|
|
|
|
|
|
|
def get_datetime(datetime_str=None): |
|
|
def get_datetime(datetime_str=None): |
|
|
if not datetime_str: |
|
|
if not datetime_str: |
|
|