Skip to content

fix : replaced deprecated datetime.utcnow with timezone-aware alternative in certification.py - #1355

Open
tmdeveloper007 wants to merge 2 commits into
komalharshita:mainfrom
tmdeveloper007:#1350
Open

fix : replaced deprecated datetime.utcnow with timezone-aware alternative in certification.py#1355
tmdeveloper007 wants to merge 2 commits into
komalharshita:mainfrom
tmdeveloper007:#1350

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Summary of What Has Been Done

Replaced all occurrences of the deprecated datetime.utcnow() with datetime.now(timezone.utc) in src/utils/certification.py. This addresses the Python 3.12+ deprecation warning for naive UTC datetime objects.

Changes Made

  • Changed from datetime import datetime to from datetime import datetime, timezone in the import statement
  • Replaced 5 occurrences of datetime.utcnow() with datetime.now(timezone.utc) across the following methods:
    • create_assessment
    • submit_assessment
    • _issue_certificate
    • _generate_verification_code
    • issue_digital_badge

Impact it Made

  • Code is now compatible with Python 3.12+ and future Python versions
  • Uses timezone-aware datetime objects which prevent subtle timezone-related bugs
  • Follows Python best practices as recommended by the official deprecation notice

Closes #1350

Note: please assign this PR to the tmdeveloper007 account.

@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix : replace deprecated datetime.utcnow with timezone-aware alternative in certification.py

1 participant