Skip to content

Commit f61d90e

Browse files
LOcal date formate issue fix
1 parent e11ff90 commit f61d90e

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/backend/app_kernel.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import os
55
import uuid
66
from typing import Dict, List, Optional
7+
import uvicorn
8+
import locale
79

810
# Semantic Kernel imports
911
from app_config import config
@@ -676,6 +678,16 @@ async def get_plans(
676678
plan_with_steps.update_step_counts()
677679
list_of_plans_with_steps.append(plan_with_steps)
678680

681+
# Print local system preference date format, selected language, and language code
682+
683+
# Get system locale settings
684+
system_locale = locale.getdefaultlocale()
685+
language_code = system_locale[0] if system_locale else "unknown"
686+
687+
# Add "local_system_language_selecetd" to each plan
688+
for plan in list_of_plans_with_steps:
689+
plan.user_locale = language_code.replace("_", "-")
690+
679691
return list_of_plans_with_steps
680692

681693

@@ -1185,10 +1197,5 @@ async def get_task_examples():
11851197
"examples": examples,
11861198
"usage": "POST /api/tasks with any of the example payloads to see locale-specific date formatting"
11871199
}
1188-
1189-
1190-
# Run the app
11911200
if __name__ == "__main__":
1192-
import uvicorn
1193-
1194-
uvicorn.run("app_kernel:app", host="127.0.0.1", port=8000, reload=True)
1201+
uvicorn.run("app_kernel:app", host="127.0.0.1", port=8000, reload=True)

src/frontend/src/models/plan.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export interface PlanWithSteps extends Plan {
9999
completed: number;
100100
/** Count of steps failed */
101101
failed: number;
102+
user_locale?: string; // Added to store the user's locale for date formatting
102103
}
103104

104105

src/frontend/src/services/TaskService.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class TaskService {
3131
completed_steps: plan.completed,
3232
total_steps: plan.total_steps,
3333
status: apiService.isPlanComplete(plan) ? "completed" : "inprogress",
34-
date: new Intl.DateTimeFormat(undefined, {
34+
date: new Intl.DateTimeFormat(plan?.user_locale, {
3535
dateStyle: "long",
3636
// timeStyle: "short",
3737
}).format(new Date(plan.timestamp)),

0 commit comments

Comments
 (0)