{"_id":"flatpickr-year-select-plugin","_rev":"3-1023e3d1639020806507a8d0541fd89f","name":"flatpickr-year-select-plugin","dist-tags":{"latest":"1.3.1"},"versions":{"1.0.0":{"name":"flatpickr-year-select-plugin","version":"1.0.0","author":{"name":"bearholmes","email":"bearholmes@gmail.com"},"license":"MIT","_id":"flatpickr-year-select-plugin@1.0.0","maintainers":[{"name":"bearholmes","email":"bearholmes@gmail.com"}],"homepage":"https://github.com/bearholmes/flatpickr-year-select-plugin#readme","bugs":{"url":"https://github.com/bearholmes/flatpickr-year-select-plugin/issues"},"dist":{"shasum":"5ce15fc697ed988f76828e164dc2f241d3a94f67","tarball":"https://registry.npmjs.org/flatpickr-year-select-plugin/-/flatpickr-year-select-plugin-1.0.0.tgz","fileCount":17,"integrity":"sha512-vnsbiuBBUuRodgPII1Lf+SZxvSxjGcsXKXuutDxshHVCjbAaIoRu8mdFeGXSTzG71JOpy9/ujA1iyBtSIGrTkw==","signatures":[{"sig":"MEQCIDXvF3LGIDVJZypu7DzfD2sV7OTaG2fSsdhDWWmERJc/AiBXESKSVhiJeFaiHMJrP17CpL5bBjsi2l2Qprlxbc6bgw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":27985},"main":"dist/flatpickr-year-select-plugin.js","module":"dist/flatpickr-year-select-plugin.mjs","browser":"dist/flatpickr-year-select-plugin.umd.js","gitHead":"8d42b4d7770d5af7937d391ab5e007f0a9a09c2b","scripts":{"build":"vite build  && tsc","format":"prettier . --write","build-cjs":"rollup -c","build-css":"node build-css.cjs"},"typings":"dist/types/plugin.d.ts","_npmUser":{"name":"bearholmes","email":"bearholmes@gmail.com"},"umd:main":"dist/flatpickr-year-select-plugin.umd.js","repository":{"url":"git+https://github.com/bearholmes/flatpickr-year-select-plugin.git","type":"git"},"_npmVersion":"9.5.1","description":"change year selection box","directories":{},"_nodeVersion":"18.16.0","dependencies":{"sass":"^1.64.2","vite":"^4.2.1","cssnano":"^6.0.1","flatpickr":"^4.6.13","typescript":"^5.0.2","autoprefixer":"^10.4.14","vite-plugin-dts":"^2.1.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-typescript2":"^0.35.0","rollup-plugin-node-resolve":"^5.2.0"},"_hasShrinkwrap":false,"devDependencies":{"prettier":"^2.8.4","@types/node":"^20.4.7"},"_npmOperationalInternal":{"tmp":"tmp/flatpickr-year-select-plugin_1.0.0_1691219669224_0.9224606856968944","host":"s3://npm-registry-packages"}},"1.3.0":{"name":"flatpickr-year-select-plugin","version":"1.3.0","author":{"name":"bearholmes","email":"bearholmes@gmail.com"},"license":"MIT","_id":"flatpickr-year-select-plugin@1.3.0","maintainers":[{"name":"bearholmes","email":"bearholmes@gmail.com"}],"homepage":"https://github.com/bearholmes/flatpickr-year-select-plugin#readme","bugs":{"url":"https://github.com/bearholmes/flatpickr-year-select-plugin/issues"},"dist":{"shasum":"c7d1af102ee8a0faed387e8499b8c179e1930103","tarball":"https://registry.npmjs.org/flatpickr-year-select-plugin/-/flatpickr-year-select-plugin-1.3.0.tgz","fileCount":47,"integrity":"sha512-WGZqNF9nfSP3WrHW1EvimJSJ0Q4ZMYZt4x0M1CswjE5V1jajZu0NmHTzW2eVHYbZVBpXLNDCt4m5uk9Diov56Q==","signatures":[{"sig":"MEUCIQD2Ej7TWiBBQ0EpXLQDuH0IXTGcnEdYOI/QkJizSY/8rwIgBUOjqiIHtjH7jIN3QWGuhGbCdyY4eNYwBVoY13Zhqd0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":224881},"main":"dist/flatpickr-year-select-plugin.js","type":"module","module":"dist/flatpickr-year-select-plugin.mjs","browser":"dist/flatpickr-year-select-plugin.umd.js","gitHead":"89b76c6efc13af5b836b508fd380a059036400ce","scripts":{"lint":"eslint . --ext .ts,.js,.cjs","test":"jest","build":"npm run build-js && npm run build-css","format":"prettier . --write","build-js":"vite build","lint:fix":"eslint . --ext .ts,.js,.cjs --fix","build-css":"node build-css.cjs","test:watch":"jest --watch","type-check":"tsc --noEmit","format:check":"prettier . --check","test:coverage":"jest --coverage","prepublishOnly":"npm run lint && npm run type-check && npm run test && npm run build"},"typings":"dist/types/plugin.d.ts","_npmUser":{"name":"bearholmes","email":"bearholmes@gmail.com"},"umd:main":"dist/flatpickr-year-select-plugin.umd.js","repository":{"url":"git+https://github.com/bearholmes/flatpickr-year-select-plugin.git","type":"git"},"_npmVersion":"10.8.2","description":"change year selection box","directories":{},"_nodeVersion":"20.19.5","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","sass":"^1.94.2","vite":"^7.2.4","eslint":"^9.18.0","cssnano":"^6.1.2","postcss":"^8.4.49","ts-jest":"^29.2.5","prettier":"^3.7.0","flatpickr":"^4.6.13","typescript":"^5.9.3","@types/jest":"^29.5.14","@types/node":"^20.19.25","autoprefixer":"^10.4.22","vite-plugin-dts":"^4.5.4","@testing-library/dom":"^10.4.0","eslint-config-prettier":"^10.0.1","eslint-plugin-prettier":"^5.2.1","jest-environment-jsdom":"^29.7.0","@typescript-eslint/parser":"^8.22.1","@typescript-eslint/eslint-plugin":"^8.22.1"},"peerDependencies":{"flatpickr":"^4.6.0"},"_npmOperationalInternal":{"tmp":"tmp/flatpickr-year-select-plugin_1.3.0_1764263877060_0.055124665819563434","host":"s3://npm-registry-packages-npm-production"}},"1.3.1":{"name":"flatpickr-year-select-plugin","version":"1.3.1","description":"change year selection box","type":"module","main":"dist/flatpickr-year-select-plugin.js","module":"dist/flatpickr-year-select-plugin.mjs","umd:main":"dist/flatpickr-year-select-plugin.umd.js","browser":"dist/flatpickr-year-select-plugin.umd.js","typings":"dist/types/plugin.d.ts","scripts":{"build":"npm run build-js && npm run build-css","build-js":"vite build","build-css":"node build-css.cjs","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage","lint":"eslint . --ext .ts,.js,.cjs","lint:fix":"eslint . --ext .ts,.js,.cjs --fix","format":"prettier . --write","format:check":"prettier . --check","type-check":"tsc --noEmit","prepublishOnly":"npm run lint && npm run type-check && npm run test && npm run build"},"repository":{"type":"git","url":"git+https://github.com/bearholmes/flatpickr-year-select-plugin.git"},"author":{"name":"bearholmes","email":"bearholmes@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/bearholmes/flatpickr-year-select-plugin/issues"},"homepage":"https://github.com/bearholmes/flatpickr-year-select-plugin#readme","peerDependencies":{"flatpickr":"^4.6.0"},"devDependencies":{"@testing-library/dom":"^10.4.0","@types/jest":"^29.5.14","@types/node":"^20.19.25","@typescript-eslint/eslint-plugin":"^8.22.1","@typescript-eslint/parser":"^8.22.1","autoprefixer":"^10.4.22","cssnano":"^6.1.2","eslint":"^9.18.0","eslint-config-prettier":"^10.0.1","eslint-plugin-prettier":"^5.2.1","flatpickr":"^4.6.13","jest":"^29.7.0","jest-environment-jsdom":"^29.7.0","postcss":"^8.4.49","prettier":"^3.7.0","sass":"^1.94.2","ts-jest":"^29.2.5","typescript":"^5.9.3","vite":"^7.2.4","vite-plugin-dts":"^4.5.4"},"_id":"flatpickr-year-select-plugin@1.3.1","gitHead":"eb0ef93f4cc6b12b8ebaa78430aec9a71016b19f","_nodeVersion":"20.19.5","_npmVersion":"10.8.2","dist":{"integrity":"sha512-XKwccYOB9yJZ5vBiLoj3hbKnhqCIOF0sct8VcBkmOYX1WydPvKkXxruNs/UQnzBL4b4by3ZvNyt8m/g8bAXQ0A==","shasum":"5a7741bacbf6bcc6f2b2d5613db3ae452a62d039","tarball":"https://registry.npmjs.org/flatpickr-year-select-plugin/-/flatpickr-year-select-plugin-1.3.1.tgz","fileCount":22,"unpackedSize":76364,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDKpGjJp58fwQiMjtZLwSdBcj9muUdKtJW4lIL11uH2GQIgfr6SGfDFs7xq908QCFaiWvA0nRK7PhwavKjUvUriAYs="}]},"_npmUser":{"name":"bearholmes","email":"bearholmes@gmail.com"},"directories":{},"maintainers":[{"name":"bearholmes","email":"bearholmes@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/flatpickr-year-select-plugin_1.3.1_1764264184217_0.17063658124857417"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-05T07:14:29.219Z","modified":"2025-11-27T17:23:04.678Z","1.0.0":"2023-08-05T07:14:29.400Z","1.3.0":"2025-11-27T17:17:57.265Z","1.3.1":"2025-11-27T17:23:04.420Z"},"bugs":{"url":"https://github.com/bearholmes/flatpickr-year-select-plugin/issues"},"author":{"name":"bearholmes","email":"bearholmes@gmail.com"},"license":"MIT","homepage":"https://github.com/bearholmes/flatpickr-year-select-plugin#readme","repository":{"type":"git","url":"git+https://github.com/bearholmes/flatpickr-year-select-plugin.git"},"description":"change year selection box","maintainers":[{"name":"bearholmes","email":"bearholmes@gmail.com"}],"readme":"# flatpickr Year Select Plugin\n\n<div align=\"center\">\n\n[![npm version](https://img.shields.io/npm/v/flatpickr-year-select-plugin.svg)](https://www.npmjs.com/package/flatpickr-year-select-plugin)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nA modern flatpickr plugin that replaces the default year input with a customizable dropdown select.\n\n[Demo](#demo) • [Installation](#installation) • [Usage](#usage) • [API](#api)\n\n</div>\n\n---\n\n## ✨ Features\n\n- 🎯 **Easy Integration** - Drop-in replacement for the default year selector\n- 🎨 **Theme Compatible** - Works seamlessly with all flatpickr themes\n- ⚡ **Lightweight** - Minimal overhead (~2.5KB gzipped)\n- ♿ **Accessible** - Fully keyboard navigable with ARIA labels\n- 🔧 **Configurable** - Customize the year range to your needs\n- 📦 **TypeScript Support** - Full type definitions included\n- 🌐 **Multi-Instance Safe** - Use multiple instances on the same page\n- 🔄 **Constraint-Aware** - Clamps options to `minDate`/`maxDate` (even when changed at runtime) and syncs with current/selected/default year; supports array `defaultDate` by using the first valid entry\n\n## 📦 Installation\n\n```bash\nnpm install flatpickr flatpickr-year-select-plugin\n```\n\nor with yarn:\n\n```bash\nyarn add flatpickr flatpickr-year-select-plugin\n```\n\nor with a CDN:\n\n```html\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css\" />\n<link\n  rel=\"stylesheet\"\n  href=\"https://cdn.jsdelivr.net/npm/flatpickr-year-select-plugin/dist/yearSelectPlugin.min.css\"\n/>\n\n<script src=\"https://cdn.jsdelivr.net/npm/flatpickr\"></script>\n<script src=\"https://cdn.jsdelivr.net/npm/flatpickr-year-select-plugin/dist/flatpickr-year-select-plugin.umd.js\"></script>\n```\n\n## 🚀 Usage\n\n### Basic Example\n\n```javascript\nimport flatpickr from 'flatpickr';\nimport yearSelectPlugin from 'flatpickr-year-select-plugin';\nimport 'flatpickr-year-select-plugin/dist/yearSelectPlugin.min.css';\n\nflatpickr('#myInput', {\n  plugins: [yearSelectPlugin()],\n});\n```\n\n### With Custom Range\n\n```javascript\nflatpickr('#myInput', {\n  plugins: [\n    yearSelectPlugin({\n      start: 5, // Show 5 years before current year\n      end: 5, // Show 5 years after current year\n    }),\n  ],\n});\n```\n\n### With Date Constraints\n\n```javascript\nflatpickr('#myInput', {\n  minDate: '2020-01-01',\n  maxDate: '2030-12-31',\n  plugins: [yearSelectPlugin()],\n  // The plugin automatically respects minDate and maxDate\n});\n```\n\n### TypeScript\n\n```typescript\nimport flatpickr from 'flatpickr';\nimport yearSelectPlugin from 'flatpickr-year-select-plugin';\nimport type { YearDropdownPluginConfig } from 'flatpickr-year-select-plugin';\n\nconst config: YearDropdownPluginConfig = {\n  start: 10,\n  end: 10,\n};\n\nflatpickr('#myInput', {\n  plugins: [yearSelectPlugin(config)],\n});\n```\n\n## 🎨 Demo\n\n### Basic Year Selector\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css\" />\n    <link\n      rel=\"stylesheet\"\n      href=\"https://cdn.jsdelivr.net/npm/flatpickr-year-select-plugin/dist/yearSelectPlugin.min.css\"\n    />\n  </head>\n  <body>\n    <input type=\"text\" id=\"demo\" placeholder=\"Select a date\" />\n\n    <script src=\"https://cdn.jsdelivr.net/npm/flatpickr\"></script>\n    <script src=\"https://cdn.jsdelivr.net/npm/flatpickr-year-select-plugin/dist/flatpickr-year-select-plugin.umd.js\"></script>\n    <script>\n      flatpickr('#demo', {\n        plugins: [yearSelectPlugin()],\n      });\n    </script>\n  </body>\n</html>\n```\n\n- GitHub Pages demo: this repository ships a Pages workflow (`.github/workflows/pages.yml`) that builds the package and publishes `demo/index.html` with the built assets from `dist/`. Once Pages is enabled in repository settings, the workflow will deploy on pushes to `main`.\n\n## 📖 API\n\n### Plugin Configuration\n\n| Option  | Type     | Default | Description                                     |\n| ------- | -------- | ------- | ----------------------------------------------- |\n| `start` | `number` | `3`     | Number of years to show before the current year |\n| `end`   | `number` | `3`     | Number of years to show after the current year  |\n\n### Behavior\n\n- If `minDate` is set in flatpickr config, the year range start is automatically adjusted\n- If `maxDate` is set in flatpickr config, the year range end is automatically adjusted\n- The plugin respects all flatpickr date constraints, clamps options to current `minDate`/`maxDate` (including values changed at runtime), and anchors/synchronizes the dropdown with the picker’s current/selected/default year (falls back to today). Options regenerate on open/year change to stay in sync with constraints and the calendar view.\n- `defaultDate` arrays (multi/range) are supported; the first valid date is used to anchor the initial dropdown range.\n- Internal clamping avoids redundant `changeYear` calls; calendar view and dropdown stay aligned without extra hook noise.\n- Multiple instances on the same page work independently\n\n## 🔧 Compatibility\n\n- **flatpickr**: v4.6.0 or higher\n- **Browsers**: All modern browsers (Chrome, Firefox, Safari, Edge)\n- **Frameworks**: Works with React, Vue, Angular, Svelte, and vanilla JS\n\n## 🛠️ Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build the project\nnpm run build\n\n# Build JavaScript only\nnpm run build-js\n\n# Build CSS only\nnpm run build-css\n\n# Run tests\nnpm test\n\n# Run tests in watch mode\nnpm run test:watch\n\n# Run tests with coverage\nnpm run test:coverage\n\n# Lint code\nnpm run lint\n\n# Format code\nnpm run format\n\n# Type check\nnpm run type-check\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Make your changes and add tests if applicable\n4. Run the test suite (`npm test`)\n5. Ensure linting passes (`npm run lint`)\n6. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n7. Push to the branch (`git push origin feature/AmazingFeature`)\n8. Open a Pull Request\n\nPlease ensure your code:\n\n- Passes all existing tests\n- Includes tests for new functionality\n- Follows the existing code style (enforced by ESLint and Prettier)\n- Maintains or improves code coverage\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 👤 Author\n\n[@bearholmes](https://github.com/bearholmes)\n\n## 🙏 Acknowledgments\n\n- Built for [flatpickr](https://flatpickr.js.org/) by Gregory\n- Inspired by the need for better year selection UX\n\n---\n\n<div align=\"center\">\n\nMade with ❤️ by bearholmes\n\n</div>\n","readmeFilename":"README.md"}