? profile_date.patch
Index: includes/date.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/date.inc,v
retrieving revision 1.1
diff -u -p -r1.1 date.inc
--- includes/date.inc	13 Oct 2009 21:34:14 -0000	1.1
+++ includes/date.inc	29 Apr 2010 04:39:32 -0000
@@ -193,5 +193,124 @@ function system_default_date_formats() {
     'locales' => array(),
   );
 
+  // Time only formats
+  $formats[] = array(
+    'type' => 'time',
+    'format' => 'g:ia',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'time',
+    'format' => 'H:i',
+    'locales' => array(),
+  );
+
+  // Date only formats
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'd.m.Y',
+    'locales' => array('de-ch', 'de-de', 'de-lu', 'fi-fi', 'fr-ch', 'is-is', 'pl-pl', 'ro-ro', 'ru-ru'),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'm/d/Y',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'd/m/Y',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'Y/m/d',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'M j Y',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'j M Y',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'Y M j',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'F j, Y',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'j F, Y',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'Y, F j',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'j F Y',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'j. F Y',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'D, Y-m-d',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'D, m/d/Y',
+    'locales' => array('en-us'),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'D, d/m/Y',
+    'locales' => array('en-gb', 'en-hk', 'en-ie', 'el-gr', 'es-es', 'fr-be', 'fr-fr', 'fr-lu', 'it-it', 'nl-be', 'pt-pt'),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'D, Y/m/d',
+    'locales' => array('en-ca', 'fr-ca', 'no-no', 'sv-se'),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'l, j F, Y',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'l, Y,  F j',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'l, F j, Y',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'l, j F Y',
+    'locales' => array(),
+  );
+  $formats[] = array(
+    'type' => 'date',
+    'format' => 'l, j. F Y',
+    'locales' => array(),
+  );
+
   return $formats;
 }
Index: modules/profile/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v
retrieving revision 1.290
diff -u -p -r1.290 profile.module
--- modules/profile/profile.module	23 Apr 2010 04:32:16 -0000	1.290
+++ modules/profile/profile.module	29 Apr 2010 04:39:32 -0000
@@ -296,20 +296,17 @@ function profile_view_field($account, $f
       case 'url':
         return '<a href="' . check_url($value) . '">' . check_plain($value) . '</a>';
       case 'date':
-        $format = substr(variable_get('date_format_short', 'm/d/Y - H:i'), 0, 5);
-        // Note: Avoid PHP's date() because it does not handle dates before
-        // 1970 on Windows. This would make the date field useless for e.g.
-        // birthdays.
-        $replace = array(
-          'd' => sprintf('%02d', $value['day']),
-          'j' => $value['day'],
-          'm' => sprintf('%02d', $value['month']),
-          'M' => map_month($value['month']),
-          'Y' => $value['year'],
-          'H:i' => NULL,
-          'g:ia' => NULL,
-        );
-        return strtr($format, $replace);
+        $format = variable_get('date_format_date', 'm/d/Y');
+        if ($value['year'] > 2038 || $value['year'] < 1950) {
+          // If the year is outside the normal range, use a calculated year.
+          $calculated_year = $value['year'] < 1970 ? $value['year'] + ceil((1970 - $value['year']) / 28) * 28 : $value['year'] - ceil(($value['year'] - 2028) / 28) * 28;
+          $format = str_replace(array('Y', 'y'), array("\xFF", "\xFE"), $format);
+          $calculated_date = date($format, mktime(0, 0, 0, $value['month'], $value['day'], $calculated_year));
+          return str_replace(array("\xFF", "\xFE"), array($value['year'], substr($value['year'], 2, 2)), $calculated_date);
+        }
+        else {
+          return date($format, mktime(0, 0, 0, $value['month'], $value['day'], $value['year']));
+        }
       case 'list':
         $values = preg_split("/[,\n\r]/", $value);
         $fields = array();
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.925
diff -u -p -r1.925 system.module
--- modules/system/system.module	28 Apr 2010 20:29:26 -0000	1.925
+++ modules/system/system.module	29 Apr 2010 04:39:33 -0000
@@ -3294,6 +3294,8 @@ function system_date_format_types() {
     'long' => t('Long'),
     'medium' => t('Medium'),
     'short' => t('Short'),
+    'date' => t('Date'),
+    'time' => t('Time'),
   );
 }
 
