Skip to content

[Repo Assist] [JS/TS] Fix implicit DateTime→DateTimeOffset conversion emitting missing op_Implicit - #4417

Open
github-actions[bot] wants to merge 1 commit into
mainfrom
repo-assist/fix-issue-3908-datetimeoffset-op-implicit-0c9d06aa2681a551
Open

github-actions[bot] wants to merge 1 commit into
mainfrom
repo-assist/fix-issue-3908-datetimeoffset-op-implicit-0c9d06aa2681a551

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Fixes #3908 — implicit conversion from DateTime to DateTimeOffset generates a call to a non-existent op_Implicit function in the runtime library, causing:

SyntaxError: The requested module '…/DateOffset.js' does not provide an export named 'op_Implicit'

Root Cause

When F# compiles let dto: DateTimeOffset = someDateTime, it emits a call to op_Implicit. In Replacements.fs, the dateTimeOffset function had no case for "op_Implicit", so it fell through to the catch-all handler:

| meth ->
    let meth = Naming.removeGetSetPrefix meth |> Naming.lowerFirst
    Helper.LibCall(com, moduleName, meth, t, args, ...)

This generated import { op_Implicit } from "…/DateOffset.js" — but op_Implicit was never exported from that module.

Fix

Add an explicit "op_Implicit" case that redirects to the existing fromDate function, which already handles DateTime → DateTimeOffset conversion (it's used by the .ctor path when a DateTime is passed):

| "op_Implicit" ->
    Helper.LibCall(com, moduleName, "fromDate", t, args, i.SignatureArgTypes, ?loc = r)
    |> Some

Changed file: src/Fable.Transforms/Replacements.fs — 3-line addition in the dateTimeOffset handler.

Test

Added a test in tests/Js/Main/DateTimeTests.fs that assigns a DateTime to a DateTimeOffset binding and verifies the UtcDateTime round-trips correctly.

Closes #3908

Generated by Repo Assist · ◷

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

…mplicit

Implicit conversion from DateTime to DateTimeOffset was falling through
to the catch-all handler in dateTimeOffset replacements, which generated
a call to a non-existent `op_Implicit` function in DateOffset.js,
causing a runtime SyntaxError.

Fix: add an explicit `op_Implicit` case that redirects to `fromDate`,
matching the existing .ctor path for DateTime arguments.

Closes #3908

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added automation Automated changes repo-assist Created by Repo Assist labels Mar 18, 2026
@MangelMaxime
MangelMaxime marked this pull request as ready for review March 18, 2026 22:11
@github-actions github-actions Bot mentioned this pull request Apr 1, 2026
2 of 41 tasks
@MangelMaxime
MangelMaxime force-pushed the main branch 2 times, most recently from 7ceced2 to c85af32 Compare June 30, 2026 21:38

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation Automated changes repo-assist Created by Repo Assist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implicit conversion import error when DateTime promoted to DateTimeOffset

0 participants