Groundhog day (originally badger day in medieval Europe) used to be February 6th, exactly six weeks before the first day of spring (March 20th).
Therefore, if the badger saw his shadow on that day there would be six more weeks of winter.
Of course, if the badger didn't see his shadow there would be half a dozen more weeks of winter.
However, the Julian calendar, used by most of the western world at the time, didn't account for leap years correctly.
That caused badger to drift from February 6th to February 2nd.
This wasn't corrected when the western world switched from the Julian calendar to the Gregorian calendar.
With the special day no longer exactly six weeks before the first day of spring, the humor in the saying was lost.