Opened 3 years ago

Closed 3 years ago

#1888 closed Bug (fixed)

Piwik_Period_Day->toString() should support variable formats

Reported by: mrisher Owned by:
Priority: low Milestone: 1.x - Piwik 1.x
Component: Core Keywords:
Cc: Sensitive: no


The toString() method is hard-coded to "Y-m-d" format. It should accept an override with a default parameter of Y-m-d for backwards compatibility.

Attachments (1)

patch (1.5 KB) - added by mrisher 3 years ago.
Patch to close this ticket.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 3 years ago by vipsoft (robocoder)

  • Milestone set to 1.1 - Piwik 1.1

mrisher: What's your use case?

btw if we change the method signature, this should be uniform across Period.php and Period/*.php.

comment:2 Changed 3 years ago by matt (mattab)

  • Milestone changed from 1.1 - Piwik 1.1 to 1.x - Piwik 1.x
  • Priority changed from normal to low

comment:3 Changed 3 years ago by mrisher

Sorry, I had replied but received a bug.

I agree about changing the other Period/* files. This syntax matches that of Date.php so for consistency it seems worth adding.

The use case is, I have a downstream data provider that is being merged into a plugin, and it requires a specific date format with a different delimiter.

I can make the change and check in; should I attach Patch files here or do it in SVN?

Thank you,

comment:4 Changed 3 years ago by matt (mattab)

please attach your patch, thanks

comment:5 Changed 3 years ago by mrisher

Period.php, Day.php, and Range.php have toString() methods, so I have updated those.
Week.php, Month.php, and Year.php do not have a toString() method, so I have not changed those in this fix.

Changed 3 years ago by mrisher

Patch to close this ticket.

comment:6 Changed 3 years ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from new to closed

(In [3755]) Fixes #1888

Note: Year Period is not toStringable - does it still solve your use case?

Note: See TracTickets for help on using tickets.