fix: use date strings for mark attendance date#4949
Open
nareshkannasln wants to merge 2 commits into
Open
Conversation
nareshkannasln
marked this pull request as ready for review
July 16, 2026 13:54
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
Contributor
Confidence Score: 5/5Safe to merge — two-line targeted fix that correctly converts moment objects to ISO date strings for Frappe's Date control. The change is minimal and directly addresses the documented error. frappe.datetime.obj_to_str is the standard Frappe utility for this conversion, and the fix applies symmetrically to both date fields. No files require special attention. Reviews (1): Last reviewed commit: "chore: update date string with obj_to_st..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
In the Mark Attendance dialog, the Start and End date fields set their defaults to native JS
Dateobjects viamoment().toDate(). Frappe'sDatecontrol expects a string.Error Log: {
"exception": "frappe.exceptions.ValidationError: Wed Jul 01 2026 00:00:00 GMT+0530 (India Standard Time) is not a valid date string.",
"exc_type": "ValidationError",
"_exc_source": "hrms (app)",
"exc": "["Traceback (most recent call last):\n File \"apps/frappe/frappe/utils/data.py\", line 139, in getdate\n return datetime.date.fromisoformat(string_date)\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^\nValueError: Invalid isoformat string: 'Wed Jul 01 2026 00:00:00 GMT+0530 (India Standard Time)'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"apps/frappe/frappe/utils/data.py\", line 142, in getdate\n return parser.parse(string_date, dayfirst=parse_day_first).date()\n ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"env/lib/python3.14/site-packages/dateutil/parser/_parser.py\", line 1368, in parse\n return DEFAULTPARSER.parse(timestr, **kwargs)\n ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^\n File \"env/lib/python3.14/site-packages/dateutil/parser/parser.py\", line 643, in parse\n raise ParserError(\"Unknown string format: %s\", timestr)\ndateutil.parser.parser.ParserError: Unknown string format: Wed Jul 01 2026 00:00:00 GMT+0530 (India Standard Time)\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"apps/frappe/frappe/app.py\", line 125, in application\n response = frappe.api.handle(request)\n File \"apps/frappe/frappe/api/init.py\", line 64, in handle\n data = endpoint(**arguments)\n File \"apps/frappe/frappe/api/v1.py\", line 46, in handle_rpc_call\n return frappe.handler.handle()\n ~~~~~~~~~~~~~~~~~~~~~^^\n File \"apps/frappe/frappe/handler.py\", line 54, in handle\n data = execute_cmd(cmd)\n File \"apps/frappe/frappe/handler.py\", line 87, in execute_cmd\n return frappe.call(method, **frappe.form_dict)\n ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"apps/frappe/frappe/init.py\", line 1139, in call\n return fn(*args, **newargs)\n File \"apps/frappe/frappe/utils/typing_validations.py\", line 49, in wrapper\n return func(*args, **kwargs)\n File \"apps/hrms/hrms/hr/doctype/attendance/attendance.py\", line 440, in get_unmarked_days\n from_date = max(getdate(from_date), joining_date or getdate(from_date))\n ~~~~~~~^^^^^^^^^^^\n File \"apps/frappe/frappe/utils/data.py\", line 144, in getdate\n frappe.throw(\n ~~~~~~~~~~~~^\n \tfrappe.(\"{} is not a valid date string.\").format(frappe.bold(string_date)),\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n \ttitle=frappe.(\"Invalid Date\"),\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"apps/frappe/frappe/utils/messages.py\", line 159, in throw\n msgprint(\n ~~~~~~~~^\n \tmsg,\n ^^^^\n ...<7 lines>...\n \tallow_dangerous_html=allow_dangerous_html,\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"apps/frappe/frappe/utils/messages.py\", line 118, in msgprint\n _raise_exception()\n ~~~~~~~~~~~~~~~~^^\n File \"apps/frappe/frappe/utils/messages.py\", line 59, in _raise_exception\n raise exc\nfrappe.exceptions.ValidationError: Wed Jul 01 2026 00:00:00 GMT+0530 (India Standard Time) is not a valid date string.\n"]",
"_server_messages": "["{\"message\":\"Wed Jul 01 2026 00:00:00 GMT+0530 (India Standard Time) is not a valid date string.\",\"as_table\":false,\"title\":\"Invalid Date\",\"indicator\":\"red\",\"raise_exception\":1,\"__frappe_exc_id\":\"82565168f842d132551438938311a247cfb479d614e72c211d50d3b9\"}"]"
}
Before:
Screencast.from.2026-07-16.19-10-02.webm
After:
Screencast.from.2026-07-16.18-45-23.webm
Backport needed for v15, v16