Skip to content

Fix DateTimeUtils UTC string semantics and remove deprecated substr usage#439

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-utc-to-string-bug
Draft

Fix DateTimeUtils UTC string semantics and remove deprecated substr usage#439
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-utc-to-string-bug

Conversation

Copy link
Copy Markdown

Copilot AI commented May 28, 2026

DateTimeUtils.UTCToString was returning local-time output (toTimeString()), which contradicted its UTC naming and made output timezone-dependent across environments. The DateTimeUtils UTC parsing methods also used legacy substr().

  • UTC output correctness

    • UTCToString now returns a UTC-stable HH:MM:SS value derived from toISOString() instead of local-time toTimeString().
  • Deprecated API cleanup

    • Replaced substr() with substring() in:
      • UTCToString
      • UTCDateTimeToString
  • Focused coverage for UTC formatting paths

    • Added lib/DateTimeUtils.test.ts to cover:
      • UTCToString('1530') -> '15:30:00'
      • UTCDateTimeToString handling for both HHMM and HHMMSS
public static UTCToString(UTCString: string) {
  let utcDate = new Date();
  utcDate.setUTCHours(
    +UTCString.substring(0, 2),
    +UTCString.substring(2, 4),
    0,
  );
  return utcDate.toISOString().substring(11, 19);
}

Copilot AI changed the title [WIP] Fix DateTimeUtils.UTCToString to return UTC time Fix DateTimeUtils UTC string semantics and remove deprecated substr usage May 28, 2026
Copilot AI requested a review from kevinelliott May 28, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: DateTimeUtils.UTCToString returns local time despite the "UTC" name (also: deprecated substr)

2 participants