Error message

The spam filter installed on this site is currently unavailable. Per site policy, we are unable to accept new submissions until that problem is resolved. Please try resubmitting the form in a couple of minutes.

Apply a Patch to a Drupal Module

Category: 

So after rolling out a bunch of new changes to a website, which involved an update to the Date module, a bug was introduced that was not detected during testing.

After some research, the bug was well known in the Drupal community (http://drupal.org/node/523218). The bug happens with a CCK Date Field w/ both 'From date' and 'To date' options. When the 'Default value' is set to 'Now' and the 'Default value for To Date' is set to 'blank', the 'To date' is getting set to the same value as the 'From date'... which of course is not the desired behavior. After reading through the whole issue, it looked like the patch provided in comment #39 was the best.

In the example below I needed to apply the .patch file date_523218.patch to the file date_elements.inc

So to apply the patch:


  1. Download the .patch file
  2. Place the .patch file in the module's directory (e.g. sites/all/modules/date)
  3. Navigate to the same directory as the .patch file in a terminal window
  4. Execute this terminal command: patch --dry-run date_elements.inc date_523218.patch

You should see some output explaining the results of the 'dry run' if all looks well, remove the '--dry-run' option and then run this command: 

patch date_elements.inc date_523218.patch

You can always type 'man patch' into a terminal to learn more about the patch command. Be careful not to type 'man patch' into Google, or you may get some unwanted results.

Add new comment