{"id":25504,"library":"eslint-plugin-date","title":"eslint-plugin-date","description":"An ESLint plugin that enforces safe Date usage in JavaScript to prevent timezone-related bugs. It bans direct usage of `new Date()`, `moment`, `dayjs`, and `date-fns` in favor of safer alternatives. The current version is 0.0.0 and has not seen active development. It is forked from Skyscanner's eslint-plugin-skyscanner-dates with business-specific changes. The plugin provides three config presets: recommended, error, and warn.","status":"active","version":"0.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install eslint-plugin-date","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-date","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-date","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; ESLint plugin requires ESLint to run.","package":"eslint","optional":false}],"imports":[{"note":"ESM-only package. Use import for ES modules.","wrong":"const date = require('eslint-plugin-date')","symbol":"plugin","correct":"import date from 'eslint-plugin-date'"},{"note":"Configs are exported as named exports. CommonJS require is not supported.","wrong":"const { configs } = require('eslint-plugin-date')","symbol":"configs","correct":"import { configs } from 'eslint-plugin-date'"},{"note":"Rules are also named exports. Direct require of property works but dispreferred.","wrong":"const rules = require('eslint-plugin-date').rules","symbol":"rules","correct":"import { rules } from 'eslint-plugin-date'"}],"quickstart":{"code":"// .eslintrc.js\nmodule.exports = {\n  plugins: ['date'],\n  extends: ['plugin:date/recommended'],\n  rules: {\n    'date/no-date-fns': 'off',\n    'date/no-moment-dayjs': 'error',\n    'date/no-new-date-with-args': 'error',\n    'date/no-new-date-without-args': 'off'\n  }\n};","lang":"javascript","description":"Configures ESLint to use the date plugin with recommended settings and custom rule overrides."},"warnings":[{"fix":"Use import syntax or enable ESM in your project.","message":"Plugin uses ESM exports only; CommonJS require may fail in older Node versions.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Use the plugin's recommended config or selectively disable rules for allowed libraries.","message":"Rules like 'no-date-fns' and 'no-moment-dayjs' are loosely named; they prevent any usage including safe patterns.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Manually replace forbidden Date patterns with approved date handling utilities.","message":"The plugin does not provide automatic fixes; it only reports errors.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider using a maintained alternative like eslint-plugin-date-rules or a custom rule.","message":"The plugin is based on an older fork of Skyscanner's dates plugin and may not receive updates.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.0.0':43 'activ':48 'altern':38 'ban':22 'bug':20 'busi':63 'business-specif':62 'chang':65 'config':70 'current':40 'date':4,11,27,32,60 'date-fn':31 'dayj':29 'develop':49 'direct':23 'enforc':9 'error':73 'eslint':2,6,57 'eslint-plugin-d':1 'eslint-plugin-skyscanner-d':56 'favor':35 'fns':33 'fork':52 'javascript':14,76 'moment':28 'new':26 'plugin':3,7,58,67 'preset':71 'prevent':16 'provid':68 'recommend':72 'relat':19 'safe':10 'safer':37 'seen':47 'skyscann':54,59 'specif':64 'three':69 'timezon':18 'timezone-rel':17 'usag':12,24 'version':41 'warn':75","created_at":"2026-05-01T13:45:06.770001+00:00","updated_at":"2026-05-01T13:45:06.770001+00:00","problems":[{"fix":"npm install --save-dev eslint-plugin-date","cause":"Plugin not installed or missing from package.json.","error":"Error: Failed to load plugin 'date' declared in '.eslintrc': Cannot find module 'eslint-plugin-date'"},{"fix":"Use `import date from 'eslint-plugin-date'` or adjust ESLint config to use string 'date'.","cause":"Incorrect import of plugin; using require instead of import.","error":"TypeError: date is not a function"},{"fix":"Check available rules: 'date/no-new-date-with-args', 'date/no-new-date-without-args', 'date/no-date-fns', 'date/no-moment-dayjs'.","cause":"Using a rule name that doesn't exist in the plugin.","error":"ESLint: 'date/no-date-fns' rule has been removed or is not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://","github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-date","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}