Rules

no-js-date

Use Effect DateTime and Duration instead of native Date operations.

Purpose and behavior

Use Effect DateTime and Duration instead of native Date operations.

The rule reports new Date() and Date.now, Date.parse or Date.UTC member access, including references without calls. The rule allows the Date identifier and Date.prototype. Give a suppression reason when an external API requires native Date.

Options

No configurable options. Enable with "rules/no-js-date": "error".

Invalid example

const d = new Date()

Valid example

const d = DateTime.now

Fixes and exceptions

This rule provides no automatic fix. Rewrite the code to preserve its intended behavior.

For a boundary exception, use oxlint-disable-next-line rules/no-js-date -- reason. Examples cover this rule only and may omit imports or declarations.

Source and tests

Enabled by the Effect preset.

no-js-date.ts · Tests