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

Fix numeric strings parsed as datetime objects #358

Merged
merged 4 commits into from
Sep 10, 2024

Conversation

shemogumbe
Copy link
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
Copy link

Copy link
Member

@baywet baywet left a comment

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