Skip to content

Add support for Windows time zone name format #612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xhy8282 opened this issue Feb 10, 2025 · 4 comments
Open

Add support for Windows time zone name format #612

xhy8282 opened this issue Feb 10, 2025 · 4 comments
Labels
enhancement New feature or request server-time Reference implementation for the Time MCP server - src/time

Comments

@xhy8282
Copy link

xhy8282 commented Feb 10, 2025

Bug Description

When using Windows system time zone name "中国标准时间", the following error occurs:

zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key 中国标准时间'

This is because the code only supports IANA time zone database format but not Windows time zone names.

Proposed Solution

Add a mapping from Windows time zone names to IANA time zone names. For example:

  • "中国标准时间" -> "Asia/Shanghai"
  • "China Standard Time" -> "Asia/Shanghai"

We could:

  1. Add a mapping dictionary for common Windows time zone names
  2. Try the provided time zone name first, if failed:
    • Check if it's in the Windows mapping
    • Convert to IANA name and try again
    • If still fails, fallback to current behavior

Impact

This would improve compatibility for Windows users who are using system time zone settings.

Additional Context

  • Windows and IANA use different time zone naming conventions
  • This issue specifically affects Chinese Windows users
  • Similar mapping might be needed for other Windows time zones
@Cayde0620
Copy link

any fix for this problem

@jtuki
Copy link

jtuki commented Apr 2, 2025

Any fix for this problem?

@aspack00
Copy link

aspack00 commented Apr 3, 2025

注意这是启动mcp服务器,只有你用mcp client如cursor的发出命令的时候该服务才会返回时间,直接在cmd下执行是个黑框,表示等待接受客户端请求:
python -m mcp_server_time --local-timezone=Asia/Shanghai

Image

Image

@CaydeLKC
Copy link

CaydeLKC commented Apr 3, 2025

注意这是启动mcp服务器,只有你用mcp client如cursor的发出命令的时候该服务才会返回时间,直接在cmd下执行是个黑框,表示等待接受客户端请求: python -m mcp_server_time --local-timezone=Asia/Shanghai

Image

Image

how do i use this with VScode MCP then.

@olaservo olaservo added enhancement New feature or request server-time Reference implementation for the Time MCP server - src/time labels May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server-time Reference implementation for the Time MCP server - src/time
Projects
None yet
Development

No branches or pull requests

6 participants