Skip to content

Commit

Permalink
Update Version date conversion with non-US format
Browse files Browse the repository at this point in the history
VersionAddCommand and VersionUpdateCommand now accept a Unix timestamp
as payload for timestamp (date_order).

manage_proj_ver_update.php calls date_strtotime() on the $f_timestamp
parameter to build the VersionUpdateCommand payload.

Fixes #34928
  • Loading branch information
dregad committed Feb 26, 2025
1 parent 4fc3412 commit 0296679
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion core/commands/VersionAddCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ function validate() {
}

$t_timestamp = $this->payload( 'timestamp', '' );
$this->timestamp = is_blank( $t_timestamp ) ? null : strtotime( $t_timestamp );
$this->timestamp = is_blank( $t_timestamp )
? null
: ( is_int( $t_timestamp ) ? $t_timestamp : strtotime( $t_timestamp ) );
}

/**
Expand Down
6 changes: 4 additions & 2 deletions core/commands/VersionUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ protected function process() {
}

$t_timestamp = $this->payload( 'timestamp' );
if( !is_null( $t_timestamp ) && !is_blank( $t_timestamp ) ) {
$t_timestamp = strtotime( $t_timestamp );
if( !is_blank( $t_timestamp ) ) {
if( !is_int( $t_timestamp ) ) {
$t_timestamp = strtotime( $t_timestamp );
}
$t_version->date_order = $t_timestamp;
}

Expand Down
2 changes: 1 addition & 1 deletion manage_proj_ver_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
'description' => $f_description,
'released' => $f_released,
'obsolete' => $f_obsolete,
'timestamp' => $f_date_order
'timestamp' => date_strtotime( $f_date_order )
)
);

Expand Down

0 comments on commit 0296679

Please sign in to comment.