Skip to content

Add ical_value property to vDatetime#1376

Open
xxiaoxiong wants to merge 1 commit into
collective:mainfrom
xxiaoxiong:add-ical-value-vdatetime
Open

Add ical_value property to vDatetime#1376
xxiaoxiong wants to merge 1 commit into
collective:mainfrom
xxiaoxiong:add-ical-value-vdatetime

Conversation

@xxiaoxiong
Copy link
Copy Markdown

This PR adds the ical_value property to vDatetime, contributing to Issue #876.

Changes

  • Added ical_value property to vDatetime (src/icalendar/prop/dt/datetime.py)
    • Returns: datetime - The Python datetime object (timezone-aware or naive)
    • Type hint: datetime
    • RFC reference: :rfc:5545#section-3.3.5
    • Includes comprehensive docstring with examples

Tests

  • Created test_vDatetime.py with 5 comprehensive test cases:
    • test_ical_value_naive - Tests timezone-naive datetime
    • test_ical_value_aware - Tests timezone-aware datetime
    • test_ical_value_utc - Tests UTC datetime
    • test_ical_value_components - Tests year/month/day/hour/minute/second components
    • test_ical_value_from_ical - Tests with parsed ical strings
  • All tests pass: 5 passed

Quality Checks

  • Add type hint
  • Add docstring with RFC reference
  • Add tests for all code paths
  • Pass ruff format check
  • Pass ruff lint check
  • All tests pass

Relates to #876

- Add ical_value property with type hints and docstring
- Returns the underlying datetime object (timezone-aware or naive)
- Add comprehensive tests for ical_value (5 test cases)
- All tests pass
- Code formatted with ruff

Relates to collective#876
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 icalendar | 🛠️ Build #32600435 | 📁 Comparing 66b0b8e against latest (7357cec)

  🔍 Preview build  

5 files changed · ± 5 modified

± Modified

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant