Repository navigation
Show the UTC weekday in the Timestamp Converter - #23
Open
SakarPaisen wants to merge 1 commit into
Open
SakarPaisen wants to merge 1 commit into
SakarPaisen wants to merge 1 commit into
Conversation
convert_timestamp returns weekday_utc, an English weekday name indexed from a fixed Monday-to-Sunday tuple using the converted UTC date, so neither the input's offset nor the machine's locale changes it. Existing values and error handling are unchanged; millisecond support (github-community-gitam#6) has not landed, so there is no extra mode to cover. Tests use the issue's epoch and midnight-crossing examples plus a negative timestamp.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes #14.
convert_timestampnow returnsweekday_utc, the English weekday name of the converted UTC date, in both directions.Scope
src/mcp_tools_lab/tools/timestamps.py— a fixedWEEKDAYStuple indexed bydate.weekday(), plus a docstring line.tests/test_timestamps.py— four new tests.docs/tool-guide.md— documents the field and the midnight-crossing example.The name comes from a fixed list rather than locale formatting, so it does not depend on the machine's language settings. Existing values and error handling are unchanged.
Tests added
"0"→ Thursday;"345600"→ Monday;"1970-01-04T00:00:00Z"into_unix→ Sunday."1970-01-02T00:30:00+01:00"is1970-01-01T23:30:00Z→ Thursday, even though the input's local date is Friday."-0.5"→ Wednesday.Millisecond mode
#6 (millisecond support) has not landed:
convert_timestampstill takes onlyvalueanddirection. There is therefore no second output mode to cover yet; when #6 lands,weekday_utcis already part of the single return statement, so it will apply there as well.Checks
python -m pytest tests/test_timestamps.py -q— 13 passedpython -m pytest -q— 66 passedpython examples/try_tools.py— runs and shows'weekday_utc': 'Thursday'python .github/scripts/check_rules.py—Scanned 11 files under src/ for print() and network imports: OK"0", the midnight-crossing offset, and"-0.5", printed and compared with the issue's examplesPython: 3.13 on Windows 11.
(Full disclosure: I used an AI coding assistant for this change, and I reviewed and verified everything submitted here.)