{"id":9643,"library":"datetime-quarter","title":"datetime-quarter library","description":"datetime-quarter is a simple and lightweight Python library that adds quarter-level support to standard `datetime` objects. It provides a `QuarterDateTime` class, allowing creation of objects representing a specific year and quarter, and methods to easily derive the start and end `datetime` for that quarter. The current version is 1.0.3, and it appears to have a stable but infrequent release cadence.","status":"active","version":"1.0.3","language":"python","source_language":"en","source_url":"https://github.com/BetaS/datetime-quarter","tags":["datetime","quarter","date","time"],"install":[{"cmd":"pip install datetime-quarter","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"wrong":"from datetime_quarter import QuarterDateTime","symbol":"DateQuarter","correct":"from datequarter import DateQuarter"},{"symbol":"quarter","correct":"from datequarter import quarter"}],"quickstart":{"code":"from datetime import datetime\nfrom datetime_quarter import QuarterDateTime\n\n# Create a QuarterDateTime object from a standard datetime\ndt_obj = datetime(2023, 7, 15)\nq_dt_from_dt = QuarterDateTime.from_datetime(dt_obj)\nprint(f\"From datetime {dt_obj}: Year={q_dt_from_dt.year}, Quarter={q_dt_from_dt.quarter}\")\nprint(f\"Start of quarter: {q_dt_from_dt.start_of_quarter}\")\nprint(f\"End of quarter: {q_dt_from_dt.end_of_quarter}\")\n\n# Create a QuarterDateTime object directly with year and quarter\nq_dt_direct = QuarterDateTime(2024, 1)\nprint(f\"Directly created: {q_dt_direct}\")\nprint(f\"Start of quarter: {q_dt_direct.start_of_quarter}\")\n\n# Perform comparisons\nprint(f\"Is 2023Q1 before 2023Q2? {QuarterDateTime(2023, 1) < QuarterDateTime(2023, 2)}\")","lang":"python","description":"Demonstrates creating `QuarterDateTime` objects from existing `datetime` objects or directly, and accessing its properties like year, quarter, and the start/end `datetime` of the quarter. Also shows basic comparison."},"warnings":[{"fix":"Use `.start_of_quarter` or `.end_of_quarter` methods to get a standard `datetime` object if you need fine-grained date/time manipulation or formatting.","message":"The `QuarterDateTime` object does not inherit directly from `datetime` and thus lacks many standard `datetime` attributes and methods (e.g., `day`, `hour`, `strftime`). It represents a quarter, not a specific point in time.","severity":"gotcha","affected_versions":"All versions"},{"fix":"This is by design. Ensure your logic correctly accounts for quarter definition based on month boundaries.","message":"When creating `QuarterDateTime` from a `datetime` object using `QuarterDateTime.from_datetime()`, the quarter is determined solely by the month of the input `datetime`. The day or time components are ignored.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'1.0.3':57 'add':16 'allow':30 'appear':60 'cadenc':68 'class':29 'creation':31 'current':54 'date':71 'datetim':2,6,23,49,69 'datetime-quart':1,5 'deriv':44 'easili':43 'end':48 'infrequ':66 'level':19 'librari':4,14 'lightweight':12 'method':41 'object':24,33 'provid':26 'python':13 'quarter':3,7,18,39,52,70 'quarter-level':17 'quarterdatetim':28 'releas':67 'repres':34 'simpl':10 'specif':36 'stabl':64 'standard':22 'start':46 'support':20 'time':72 'version':55 'year':37","created_at":"2026-04-17T01:19:57.988454+00:00","updated_at":"2026-04-17T01:19:57.988454+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.0.3","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/BetaS/datetime-quarter","docs":null,"changelog":null,"pypi":"https://pypi.org/project/datetime-quarter/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}