Skip to content

Commit 98bd595

Browse files
authored
Merge branch 'vmatt-latest' into data_import_delimiter
2 parents 3774c74 + bf8849b commit 98bd595

File tree

4 files changed

+51
-2
lines changed

4 files changed

+51
-2
lines changed

frappe/core/doctype/data_import/data_import.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,4 @@
211211
"sort_order": "DESC",
212212
"states": [],
213213
"track_changes": 1
214-
}
214+
}

frappe/core/doctype/data_import_log/data_import_log.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"in_create": 1,
6161
"index_web_pages_for_search": 1,
6262
"links": [],
63-
"modified": "2024-03-23 16:02:17.334396",
63+
"modified": "2024-04-16 17:32:34.363704",
6464
"modified_by": "Administrator",
6565
"module": "Core",
6666
"name": "Data Import Log",
@@ -77,6 +77,18 @@
7777
"role": "System Manager",
7878
"share": 1,
7979
"write": 1
80+
},
81+
{
82+
"create": 1,
83+
"delete": 1,
84+
"email": 1,
85+
"export": 1,
86+
"print": 1,
87+
"read": 1,
88+
"report": 1,
89+
"role": "SSport Role",
90+
"share": 1,
91+
"write": 1
8092
}
8193
],
8294
"sort_field": "creation",

frappe/tests/test_data.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
2+
# License: MIT. See LICENSE
3+
import datetime
4+
5+
import frappe
6+
from frappe.tests.utils import FrappeTestCase
7+
from frappe.utils.data import guess_date_format
8+
9+
test_date_obj = datetime.datetime.now()
10+
test_datetime = test_date_obj.strftime("%Y-%m-%d %H:%M:%S.%f")
11+
test_date_formats = {
12+
"%Y-%m-%d": test_date_obj.strftime("%Y-%m-%d"),
13+
"%d-%m-%Y": test_date_obj.strftime("%d-%m-%Y"),
14+
"%d/%m/%Y": test_date_obj.strftime("%d/%m/%Y"),
15+
"%d.%m.%Y": test_date_obj.strftime("%d.%m.%Y"),
16+
"%m/%d/%Y": test_date_obj.strftime("%m/%d/%Y"),
17+
"%m-%d-%Y": test_date_obj.strftime("%m-%d-%Y"),
18+
"%Y.%m.%d.": test_date_obj.strftime("%Y.%m.%d."),
19+
}
20+
test_time_formats = {
21+
"%H:%M:%S": test_date_obj.strftime("%H:%M:%S"),
22+
"%H:%M": test_date_obj.strftime("%H:%M"),
23+
}
24+
25+
26+
class TestData(FrappeTestCase):
27+
"""Tests date, time and datetime formatters and some associated
28+
utility functions. These rely on the system-wide date and time
29+
formats.
30+
"""
31+
32+
def test_guess_format(self):
33+
# Test formatdate with various default date formats set
34+
for valid_format, date_str in test_date_formats.items():
35+
frappe.db.set_default("date_format", valid_format)
36+
self.assertEqual(guess_date_format(date_str), valid_format)

frappe/utils/data.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,6 +2316,7 @@ def guess_date_format(date_string: str) -> str:
23162316
r"%y.%m.%d",
23172317
r"%d %b %Y",
23182318
r"%d %B %Y",
2319+
r"%Y.%m.%d.",
23192320
]
23202321

23212322
TIME_FORMATS = [

0 commit comments

Comments
 (0)