Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Fix numeric strings parsed as datetime objects#358

Merged
shemogumbe merged 4 commits into
mainfrom
shem/fix_numeric_strings_parsed_as_datetime_objects
Sep 10, 2024
Merged

Fix numeric strings parsed as datetime objects#358
shemogumbe merged 4 commits into
mainfrom
shem/fix_numeric_strings_parsed_as_datetime_objects

Conversation

@shemogumbe

Copy link
Copy Markdown
Contributor

Overview

From my research, ms Graph works with datetime objects that conform to ISO 8601 format such as:

  • "2024-09-10"
  • "2024-09-10 12:34:56"
  • "2024-08-18T05:26:14Z"
    These can be isolated using isdigit which is a string method as they contain characters such as -, /, : that are not string avlues

Related Issue

Fixes microsoftgraph/msgraph-sdk-python#881

Demo

Test values

test_values = [
    "2008-10-08T18:30:00.000000Z", "2008-10-08T18:30:00.000000", "20081008",
    "-PT15M", "1011317", "1150144"
]

Parsed VALUES

2008-10-08 18:30:00+00:00
2008-10-08 18:30:00+00:00
20081008
-PT15M
1011317
1150144

@shemogumbe
shemogumbe requested a review from a team as a code owner September 10, 2024 10:14
@sonarqubecloud

Copy link
Copy Markdown

@baywet baywet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the changes!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Numeric strings being converted to Datetime objects

2 participants