We can use date-fns with the following import statement.
import { format } from 'https://deno.land/x/date_fns/index.js'
date-fns publishes typings.d.ts at the root of their github repo, and we can reference it like the below.
/// <reference path="https://raw.githubusercontent.com/date-fns/date-fns/master/typings.d.ts" />
import { format } from 'https://deno.land/x/date_fns/index.js'
However the above doesn't work with the following error:
error: Uncaught ImportPrefixMissing: relative import path "date-fns" not prefixed with / or ./ or ../ Imported from "https://raw.githubusercontent.com/date-fns/date-fns/master/typings.d.ts"
â–º $deno$/dispatch_json.ts:40:11
Does anyone know how to fix the above error?
All the:
import { endOfSecond } from 'date-fns'
that are located in typings.d.ts are not compatible with Deno.
already support in vscode extension
BTW. typing.d.ts 's namespace data-fns is not compatible with Deno
- declare module 'data-fns' {
+ declare module 'https://deno.land/x/date_fns/index.js' {
export type Interval = IntervalAliased
export type Locale = LocaleAliased
export type Duration = DurationAliased
}

Or if you want something that looks more portable:
- declare module 'data-fns' {
+ declare module './date_fns/index.js' {
export type Interval = IntervalAliased
export type Locale = LocaleAliased
export type Duration = DurationAliased
}
We need to add the emitting of declarations to bundles in Deno as well, and then we would only emit module names in declarations that would work with Deno.
Can this be closed?