npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fix-ai-time

v0.1.2

Published

git precommit hook for correcting YYYY-MM-DD strings to current date

Readme

fix-ai-time

A git pre-commit hook that automatically updates dates (YYYY-MM-DD) in modified lines to the current date.

Why?

For some projects, any new date added to docs can be safely assumed to be intended to be a version of 'now' that aligns with the time the code was committed.

If your changelog or 'last updated' field is being autogenerated by AI, your timestamp is likely to be wrong. This is a simple hack to make sure it's always corrected on commit.

fix-ai-time finds dates in newly modified lines and updating them to the current date.

Warning

This is a dumb hack with a significant limitation: it will update ALL dates in any modified lines to today's date, even if those dates are legitimate historical dates that shouldn't be changed.

For example, if you edit a line containing:

Project started: 2020-01-01, Last updated: 2025-01-01

Both dates will be changed to today's date, even though the start date should have been preserved.

Only use this if:

  1. You're specifically fixing AI-generated dates
  2. You're certain that any dates in the lines you're modifying should be today's date
  3. You've reviewed the changes before committing

Future versions will be smarter about which dates to update.

Installation & Setup

  1. Install the package:
npm install --save-dev fix-ai-time
  1. Create the git hooks directory:
mkdir -p .husky
  1. Create the pre-commit hook:
echo '#!/bin/sh

# Run fix-ai-time on pre-commit
node node_modules/fix-ai-time/index.js' > .husky/pre-commit

chmod +x .husky/pre-commit
  1. Configure git to use the hooks:
git config core.hooksPath .husky

How It Works

When you make a commit, fix-ai-time:

  1. Examines the git diff of staged changes
  2. Finds YYYY-MM-DD dates in newly added or modified lines
  3. Updates any dates that are in the past to today's date
  4. Automatically stages the changes

For example, if an AI generated this line:

Last updated: 2024-03-20  # AI using old training data

It will automatically become:

Last updated: 2025-01-03  # Today's actual date

Only dates in modified lines are updated, and only if they're in the past. Future dates are assumed to be intentional and are preserved.

Configuration

Create a fix-ai-time.config.js in your project root:

export default {
  // File extensions to process
  fileExtensions: ['.md', '.mdx', '.html', '.js', '.jsx', '.ts', '.tsx'],
  
  // Custom date pattern (default: YYYY-MM-DD)
  datePattern: /\b\d{4}-\d{2}-\d{2}\b/g,
  
  // Include time in timestamps (default: false)
  includeTime: true,
  
  // Customize the timestamp format
  formatTimestamp: () => {
    const now = new Date();
    return {
      date: now.toISOString().split('T')[0],
      time: now.toISOString().split('T')[1].split('.')[0]
    };
  }
}

Configuration Options

  • fileExtensions: Array of file extensions to process
  • datePattern: Regular expression to match dates
  • includeTime: Whether to include time in the timestamp (default: false)
  • formatTimestamp: Function that must return an object with:
    • date: String in YYYY-MM-DD format
    • time: String in HH:mm:ss format

Example valid formatTimestamp:

formatTimestamp: () => ({
  date: '2024-03-21',  // Must be YYYY-MM-DD
  time: '14:30:00'     // Must be HH:mm:ss
})

When includeTime is true, dates will be formatted as YYYY-MM-DDTHH:mm:ss.

Supported File Types

By default, fix-ai-time processes files with these extensions:

  • .md
  • .mdx
  • .html
  • .js
  • .jsx
  • .ts
  • .tsx

Skipping the Hook

To skip the hook for a particular commit:

git commit --no-verify

License

MIT

Contributing

Issues and pull requests welcome!