Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions health/configs/Data/INVENTORY.MR-DN
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@
},
{
"key": "STOCK_EXPIRY",
"value": "{{fn:formatDate(item.additionalFields.fields.expiryDate, dateTime, dd MMMM yyyy)}}"
"value": "{{fn:formatDate(item.additionalFields.fields.expiryDate, 'date', dd MMM yyyy)}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for formatDate function definition and usage patterns

echo "=== Searching for formatDate in config files ==="
rg -l 'formatDate' --type json . | head -10

echo -e "\n=== Looking for INVENTORY.MR-DN file and similar patterns ==="
find . -name "*.MR-DN" -o -name "*INVENTORY*" | head -20

echo -e "\n=== Checking for formatDate function definitions ==="
rg -n 'formatDate\s*[:(]' --type js --type ts | head -20

Repository: egovernments/DIGIT-Frontend

Length of output: 769


🏁 Script executed:

#!/bin/bash
# Search for formatDate usage in config files and get more context

echo "=== Searching for all formatDate usage in config files ==="
rg 'formatDate' health/configs/Data/ -B 1 -A 1 | head -50

echo -e "\n=== Reading INVENTORY.MR-DN around line 869 ==="
sed -n '860,880p' health/configs/Data/INVENTORY.MR-DN

echo -e "\n=== Reading INVENTORY.MR-DN around line 973 ==="
sed -n '965,985p' health/configs/Data/INVENTORY.MR-DN

echo -e "\n=== Searching for formatDate function in entire codebase ==="
rg 'formatDate\s*=' --type js --type ts --type jsx --type tsx -A 3 | head -40

Repository: egovernments/DIGIT-Frontend

Length of output: 7719


Quote the format pattern dd MMM yyyy to match the correct syntax used elsewhere in the codebase.

The format pattern in the third parameter should be a string literal. Compare with STOCKREPORTS.MR-DN, which correctly uses 'dd MMM yyyy' (quoted). INVENTORY.MR-DN lines 869 and 973 have the format pattern unquoted, which is inconsistent with established patterns in the configuration files.

Correct syntax:

"value": "{{fn:formatDate(item.additionalFields.fields.expiryDate, 'date', 'dd MMM yyyy')}}"
🤖 Prompt for AI Agents
In health/configs/Data/INVENTORY.MR-DN around lines 869 (and also check line
973), the date format pattern dd MMM yyyy is unquoted; update the third argument
to be a string literal by surrounding the pattern with quotes (i.e., 'dd MMM
yyyy') so the call becomes fn:formatDate(..., 'date', 'dd MMM yyyy'); ensure
both occurrences are fixed to match the quoted pattern used elsewhere.

},
{
"key": "QUANTITY_RECEIVED",
Expand Down Expand Up @@ -970,7 +970,7 @@
},
{
"type": "template",
"value": "{{fn:formatDate(item.items[0].dateOfEntry, dateTime, dd MMMM yyyy)}}",
"value": "{{fn:formatDate(item.items[0].dateOfEntry, 'date', dd MMM yyyy)}}",
"format": "textTemplate",
"fieldName": "dateOfEntry"
}
Expand Down