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.

Reports new Date(), Date.now(), Date.parse() and Date.UTC(). Mere references and Date.prototype are allowed. Native Date at an external API boundary still needs an explicit suppression reason.

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 reports diagnostics without an automatic fix. Rewrite the code deliberately rather than guessing its intended semantics.

For a genuine boundary exception, use an oxlint-disable-next-line rules/no-js-date -- reason comment. Examples illustrate this rule alone and may omit imports and declarations.

Source and tests

Enabled by the Effect preset.

no-js-date.ts · Tests