diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module
index 5168a24..5dc2244 100644
--- a/core/modules/locale/locale.module
+++ b/core/modules/locale/locale.module
@@ -1015,11 +1015,11 @@ function locale_css_alter(&$css) {
  * Provides the language support for the jQuery UI Date Picker.
  */
 function locale_library_info_alter(&$libraries, $module) {
-  global $language;
-  if ($module == 'system' && isset($libraries['system']['ui.datepicker'])) {
+  if ($module == 'system' && isset($libraries['ui.datepicker'])) {
+    global $language;
     $datepicker = drupal_get_path('module', 'locale') . '/locale.datepicker.js';
-    $libraries['system']['ui.datepicker']['js'][$datepicker] = array('group' => JS_THEME);
-    $libraries['system']['ui.datepicker']['js'][] = array(
+    $libraries['ui.datepicker']['js'][$datepicker] = array('scope' => 'footer', 'group' => JS_THEME);
+    $libraries['ui.datepicker']['js'][] = array(
       'data' => array(
         'jqueryuidatepicker' => array(
           'rtl' => $language->direction == LANGUAGE_RTL,
diff --git a/core/modules/locale/locale.test b/core/modules/locale/locale.test
index 5c49be4..3a1e4ee 100644
--- a/core/modules/locale/locale.test
+++ b/core/modules/locale/locale.test
@@ -2823,3 +2823,28 @@ class LocaleLanguageNegotiationInfoFunctionalTest extends DrupalWebTestCase {
     }
   }
 }
+
+class LocaleLibraryInfoAlterTest extends DrupalWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Javascript library localisation',
+      'description' => 'Tests the localisation of javascript libraries.',
+      'group' => 'Locale',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('locale', 'locale_test');
+  }
+
+  /**
+  * Verify that locale_library_info_alter adds localisation to the datepicker.
+  *
+  * @see locale_library_info_alter()
+  */
+  public function testLibraryInfoAlter() {
+    drupal_add_library('system', 'ui.datepicker');
+    $scripts = drupal_get_js('footer');
+    $this->assertTrue(strpos($scripts, 'locale.datepicker.js'), t('locale.datepicker.js added to scripts in footer.'));
+  }
+}
