Development

#430 (Date format and documentation mismach)

You must first sign up to be able to contribute.

Ticket #430 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Date format and documentation mismach

Reported by: gérard lambert Assigned to:
Priority: major Milestone: 1.0.0
Component: Version: 0.7.X
Keywords: Cc:
Qualification:

Description

According to the documentation about Date helpers ( http://www.symfony-project.com/content/book/page/templating_i18n_helpers.html ), it should be possible to use the pattern "dddd" for formatting a day. However, it is not the case with the trunk. Here is a fix for lib/i18n/sfDateFormat.class.php, line 380 to 401 :

  /**
   * Get the day of the month.
   * "d" for non-padding, "dd" will always return 2 characters.
   * "dddd" will return the day name
   * @param array getdate format.
   * @param string a pattern.  
   * @return string day of the month
   */     
  protected function getDay($date, $pattern='d')
  {
    $day = $date['mday'];

    switch($pattern)
    {
      case 'd':
        return $day;
      case 'dd':
        return str_pad($day, 2,'0',STR_PAD_LEFT);
      case 'dddd':
        return $this->getDayInWeek($date);
      default:
        throw new sfException('The pattern for day of '.
            'the month is "d" or "dd" or "dddd".');
    }
  }

Change History

04/14/06 08:21:42 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

fixed in r1207.