mirror of
https://github.com/block/goose.git
synced 2026-04-26 10:40:45 +00:00
Fix scheduler jobs dates formatting (#5368)
This commit is contained in:
parent
0ca4e0ba4e
commit
774baf1cdb
2 changed files with 2 additions and 10 deletions
|
|
@ -8,8 +8,6 @@ use axum::{
|
|||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use chrono::NaiveDateTime;
|
||||
|
||||
use crate::state::AppState;
|
||||
use goose::scheduler::ScheduledJob;
|
||||
|
||||
|
|
@ -82,12 +80,6 @@ pub struct SessionDisplayInfo {
|
|||
accumulated_output_tokens: Option<i32>,
|
||||
}
|
||||
|
||||
fn parse_session_name_to_iso(session_name: &str) -> String {
|
||||
NaiveDateTime::parse_from_str(session_name, "%Y%m%d_%H%M%S")
|
||||
.map(|dt| dt.and_utc().to_rfc3339())
|
||||
.unwrap_or_else(|_| String::new()) // Fallback to empty string if parsing fails
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/schedule/create",
|
||||
|
|
@ -326,7 +318,7 @@ async fn sessions_handler(
|
|||
display_infos.push(SessionDisplayInfo {
|
||||
id: session_name.clone(),
|
||||
name: session.name,
|
||||
created_at: parse_session_name_to_iso(&session_name),
|
||||
created_at: session.created_at.to_rfc3339(),
|
||||
working_dir: session.working_dir.to_string_lossy().into_owned(),
|
||||
schedule_id: session.schedule_id,
|
||||
message_count: session.message_count,
|
||||
|
|
|
|||
|
|
@ -631,7 +631,7 @@ const ScheduleDetailView: React.FC<ScheduleDetailViewProps> = ({ scheduleId, onN
|
|||
</h3>
|
||||
<p className="text-xs text-text-subtle mt-1">
|
||||
Created:{' '}
|
||||
{session.createdAt ? new Date(session.createdAt).toLocaleString() : 'N/A'}
|
||||
{session.createdAt ? formatToLocalDateWithTimezone(session.createdAt) : 'N/A'}
|
||||
</p>
|
||||
{session.messageCount !== undefined && (
|
||||
<p className="text-xs text-text-subtle mt-1">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue