From 65e87fa8d2b8c196fffe8d8c04fd302961373a41 Mon Sep 17 00:00:00 2001
From: DonPasquale
Date: Mon, 24 Nov 2025 22:53:19 +0100
Subject: [PATCH 1/2] Enable dateFormat in create and edit records
Enable dateFormat in "create_record()" and "edit_records()".
---
fmrest/server.py | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/fmrest/server.py b/fmrest/server.py
index 07ce287..b9c4de7 100644
--- a/fmrest/server.py
+++ b/fmrest/server.py
@@ -232,7 +232,8 @@ def create(self, record: Record,
def create_record(self, field_data: Dict[str, Any],
portals: Optional[Dict[str, Any]] = None,
scripts: Optional[Dict[str, List]] = None,
- request_layout: Optional[str] = None) -> Optional[int]:
+ request_layout: Optional[str] = None,
+ date_format: Optional[str] = None) -> Optional[int]:
"""Creates a new record with given field data and returns new internal record id.
Parameters
@@ -255,13 +256,23 @@ def create_record(self, field_data: Dict[str, Any],
the value stored in the Server instance's layout attribute and is
useful if you have a shared Server instance in a multi-threaded
program.
+ date_format : str, optional
+ The date format. Choices are:
+ 'us' for US format MM/DD/YYYY,
+ 'file' for file locale format,
+ 'iso-8601' for ISO format YYYY-MM-DD.
+ If not specified, the default value is 'us'.
"""
path = self._get_api_path('record', request_layout)
request_data: Dict = {'fieldData': field_data}
+
if portals:
request_data['portalData'] = portals
+ if date_format:
+ request_data['dateFormat'] = self._date_format_for_keyword(date_format)
+
# build script param object in FMSDAPI style
script_params = build_script_params(scripts) if scripts else None
if script_params:
@@ -286,7 +297,8 @@ def edit(self, record: Record, validate_mod_id: bool = False,
def edit_record(self, record_id: int, field_data: Dict[str, Any],
mod_id: Optional[int] = None, portals: Optional[Dict[str, Any]] = None,
scripts: Optional[Dict[str, List]] = None,
- request_layout: Optional[str] = None) -> bool:
+ request_layout: Optional[str] = None,
+ date_format: Optional[str] = None) -> bool:
"""Edits the record with the given record_id and field_data. Return True on success.
Parameters
@@ -318,6 +330,12 @@ def edit_record(self, record_id: int, field_data: Dict[str, Any],
the value stored in the Server instance's layout attribute and is
useful if you have a shared Server instance in a multi-threaded
program.
+ date_format : str, optional
+ The date format. Choices are:
+ 'us' for US format MM/DD/YYYY,
+ 'file' for file locale format,
+ 'iso-8601' for ISO format YYYY-MM-DD.
+ If not specified, the default value is 'us'.
"""
path = self._get_api_path(
'record_action', request_layout).format(record_id=record_id)
@@ -329,6 +347,9 @@ def edit_record(self, record_id: int, field_data: Dict[str, Any],
if portals:
request_data['portalData'] = portals
+ if date_format:
+ request_data['dateFormat'] = self._date_format_for_keyword(date_format)
+
# build script param object in FMSDAPI style
script_params = build_script_params(scripts) if scripts else None
if script_params:
From 7772eecdbd0f98b2bad2608f0a06435817f9c398 Mon Sep 17 00:00:00 2001
From: DonPasquale
Date: Mon, 24 Nov 2025 23:00:53 +0100
Subject: [PATCH 2/2] Correct typo.
---
fmrest/server.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fmrest/server.py b/fmrest/server.py
index b9c4de7..d46efd2 100644
--- a/fmrest/server.py
+++ b/fmrest/server.py
@@ -271,7 +271,7 @@ def create_record(self, field_data: Dict[str, Any],
request_data['portalData'] = portals
if date_format:
- request_data['dateFormat'] = self._date_format_for_keyword(date_format)
+ request_data['dateFormats'] = self._date_format_for_keyword(date_format)
# build script param object in FMSDAPI style
script_params = build_script_params(scripts) if scripts else None
@@ -348,7 +348,7 @@ def edit_record(self, record_id: int, field_data: Dict[str, Any],
request_data['portalData'] = portals
if date_format:
- request_data['dateFormat'] = self._date_format_for_keyword(date_format)
+ request_data['dateFormats'] = self._date_format_for_keyword(date_format)
# build script param object in FMSDAPI style
script_params = build_script_params(scripts) if scripts else None