github-activity-generator icon indicating copy to clipboard operation
github-activity-generator copied to clipboard

Support Negative Values for days_after Parameter in Contribution Script

Open jasonuc opened this issue 1 year ago • 1 comments

Overview

This introduces the ability to use negative values for the days_after parameter in the GitHub contribution generation script. This enhancement increases the flexibility of the script, allowing users to specify a commit history that ends before the current date.

Changes

  • Modified the error check for days_after to ensure the sum of days_before and days_after is non-negative.
  • Adjusted the commit generation loop to correctly handle negative values for days_after, enabling the script to create a commit history that can end before the current date.

Impact

This change allows users to have more control over the date range for commit generation. It is particularly useful for scenarios where the user wants to backdate contributions but stop at a certain point before the current date.

Examples

Example 1: Standard Usage

  • days_before = 30
  • days_after = 10 This would generate commits from 30 days before the current date to 10 days after the current date.

Example 2: Using Negative days_after

  • days_before = 30
  • days_after = -5 This would generate commits from 30 days before the current date and stop 5 days before the current date. It's particularly useful for creating a commit history that doesn't include the most recent days.

Credit to @jeremiah-shore who gave me this idea from a suggestion

jasonuc avatar Jan 11 '24 16:01 jasonuc

Also glad for the reminder that this project exists. I literally landed the largest branch I've ever worked on yesterday... 430 commits. BUT, since we squashed it, there's no pretty green tile mosaic 😛

jeremiah-shore avatar Jan 11 '24 16:01 jeremiah-shore