fix: United SCO provider/location page selection + DOB display format
- United SCO eligibility: add Treatment Location step before Billing Entity on Provider & Location page; both use ng-arrow-wrapper ActionChains click + ARROW_DOWN/ENTER keyboard selection to handle upward-opening panels - Use visibility_of_element_located for Billing Entity label wait so code waits for page to fully render after Select Insurance modal closes - DOB (and all dates) now display as MM/DD/YYYY instead of Mon DD, YYYY Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -128,7 +128,7 @@ function isDateOnlyString(s: string): boolean {
|
||||
|
||||
// ---------- formatDateToHumanReadable ----------
|
||||
/**
|
||||
* Frontend-safe human readable formatter.
|
||||
* Frontend-safe date formatter. Output format: "MM/DD/YYYY" (e.g. "03/01/1980").
|
||||
*
|
||||
* Rules:
|
||||
* - If input is a date-only string "YYYY-MM-DD", format it directly (no TZ math).
|
||||
@@ -136,26 +136,24 @@ function isDateOnlyString(s: string): boolean {
|
||||
* - If input is any other string (ISO/timestamp), DO NOT call new Date(isoString) directly
|
||||
* for display. Instead, use parseLocalDate(dateInput) to extract the local calendar day
|
||||
* (strip time portion) and render that. This prevents off-by-one day drift.
|
||||
*
|
||||
* Output example: "Oct 7, 2025"
|
||||
*/
|
||||
export function formatDateToHumanReadable(dateInput?: string | Date): string {
|
||||
if (!dateInput) return "N/A";
|
||||
|
||||
// date-only string -> show as-is using MONTH_SHORT
|
||||
// date-only string "YYYY-MM-DD" -> m and d are already zero-padded
|
||||
if (typeof dateInput === "string" && isDateOnlyString(dateInput)) {
|
||||
const [y, m, d] = dateInput.split("-");
|
||||
if (!y || !m || !d) return "Invalid Date";
|
||||
return `${MONTH_SHORT[parseInt(m, 10) - 1]} ${d}, ${y}`;
|
||||
return `${m}/${d}/${y}`;
|
||||
}
|
||||
|
||||
// Date object -> use local calendar fields
|
||||
if (dateInput instanceof Date) {
|
||||
if (isNaN(dateInput.getTime())) return "Invalid Date";
|
||||
const dd = String(dateInput.getDate());
|
||||
const mm = MONTH_SHORT[dateInput.getMonth()];
|
||||
const dd = String(dateInput.getDate()).padStart(2, "0");
|
||||
const mm = String(dateInput.getMonth() + 1).padStart(2, "0");
|
||||
const yy = dateInput.getFullYear();
|
||||
return `${mm} ${dd}, ${yy}`;
|
||||
return `${mm}/${dd}/${yy}`;
|
||||
}
|
||||
|
||||
// Other string (likely ISO/timestamp) -> normalize via parseLocalDate
|
||||
@@ -163,10 +161,10 @@ export function formatDateToHumanReadable(dateInput?: string | Date): string {
|
||||
if (typeof dateInput === "string") {
|
||||
try {
|
||||
const localDate = parseLocalDate(dateInput);
|
||||
const dd = String(localDate.getDate());
|
||||
const mm = MONTH_SHORT[localDate.getMonth()];
|
||||
const dd = String(localDate.getDate()).padStart(2, "0");
|
||||
const mm = String(localDate.getMonth() + 1).padStart(2, "0");
|
||||
const yy = localDate.getFullYear();
|
||||
return `${mm} ${dd}, ${yy}`;
|
||||
return `${mm}/${dd}/${yy}`;
|
||||
} catch (err) {
|
||||
console.error("Invalid date input provided:", dateInput, err);
|
||||
return "Invalid Date";
|
||||
|
||||
Reference in New Issue
Block a user