Make Rsx_Time::format() private, unify PHP/JS time API

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2026-01-28 04:55:44 +00:00
parent 4ad8dde6ad
commit 6dde3bc4e7
3 changed files with 130 additions and 8 deletions

View File

@@ -548,14 +548,14 @@ class Rsx_Time
// =========================================================================
/**
* Format time using pattern
* Format time using pattern (internal helper)
*
* @param mixed $time
* @param string $format PHP date() format string
* @param string|null $timezone If null, uses user's timezone
* @return string
*/
public static function format($time, string $format, ?string $timezone = null): string
private static function _format($time, string $format, ?string $timezone = null): string
{
$tz = $timezone ?? static::get_user_timezone();
try {
@@ -575,7 +575,7 @@ class Rsx_Time
*/
public static function format_date($time, ?string $timezone = null): string
{
return static::format($time, 'M j, Y', $timezone);
return static::_format($time, 'M j, Y', $timezone);
}
/**
@@ -587,7 +587,7 @@ class Rsx_Time
*/
public static function format_time($time, ?string $timezone = null): string
{
return static::format($time, 'g:i A', $timezone);
return static::_format($time, 'g:i A', $timezone);
}
/**
@@ -599,7 +599,7 @@ class Rsx_Time
*/
public static function format_datetime($time, ?string $timezone = null): string
{
return static::format($time, 'M j, Y g:i A', $timezone);
return static::_format($time, 'M j, Y g:i A', $timezone);
}
/**
@@ -611,7 +611,7 @@ class Rsx_Time
*/
public static function format_datetime_with_tz($time, ?string $timezone = null): string
{
return static::format($time, 'M j, Y g:i A T', $timezone);
return static::_format($time, 'M j, Y g:i A T', $timezone);
}
// =========================================================================