Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implicit conversion import error when DateTime promoted to DateTimeOffset #3908

Open
joprice opened this issue Sep 29, 2024 · 1 comment
Open

Comments

@joprice
Copy link
Contributor

joprice commented Sep 29, 2024

Description

When a DateTime gets implicitly converted to a DateTimeOffset, the import op_Implicit is missing in the js library:

SyntaxError: The requested module 'https://fable.io/repl/js/repl/fable-library-js/DateOffset.js' does not provide an export named 'op_Implicit' (at 0110e4f1-0010-49d1-b621-0c084f71ae75:62:10)

Repro code

open System

let _: DateTimeOffset = DateTime.UtcNow.Date
import { op_Implicit } from "fable-library-js/DateOffset.js";
import { utcNow, date } from "fable-library-js/Date.js";

op_Implicit(date(utcNow()));

Related information

  • Fable version: 4.19.3
  • Operating system: OSX
@MangelMaxime
Copy link
Member

I think we can just alias to op_Implicit to fromDate:

// Write code or load a sample from sidebar
open System

let _: DateTimeOffset = DateTime.UtcNow.Date

let x = DateTimeOffset(DateTime.UtcNow.Date)
import { fromDate, op_Implicit } from "fable-library-js/DateOffset.js";
import { utcNow, date } from "fable-library-js/Date.js";

op_Implicit(date(utcNow()));

export const x = fromDate(date(utcNow()));

We can do it directly in the Replacement module to avoid having a new function in fable-library, I will have a look at it later.

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

No branches or pull requests

2 participants