diff --git a/CHANGELOG.md b/CHANGELOG.md index c006410..08fae1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.2.0] - 2026-04-16 + +### Added + +- `PlanetaryTime.time` property — current time of sol as formatted string `HH:MM:SS` +- `PlanetaryTime.date` property — current date as formatted string `Year X, Sol Y` + ## [1.1.0] - 2026-04-16 ### Added diff --git a/PROJECT.md b/PROJECT.md index a141eac..41591ba 100644 --- a/PROJECT.md +++ b/PROJECT.md @@ -76,14 +76,14 @@ Moon and dwarf planets (Pluto, Ceres, Eris) may be added later. - Project scaffolded (Poetry, src layout, tests directory) - No implementation yet -## TODO +## Pending work -- Define `Body` enum with rotation periods -- Define `Epoch` enum and epoch registry -- Implement core `PlanetaryTime` class -- Implement conversion from Earth `datetime` -- Implement `__str__` / `__repr__` -- Write tests for conversion accuracy -- Write tests for epoch switching -- Populate README with usage examples -- Implement `scripts/refresh_data.py` — fetches rotation periods, orbital periods and discovery dates from Wikidata SPARQL endpoint and regenerates hardcoded data in `body.py`, `moon.py` and `epoch.py`; script is not part of the distributed package +- TODO: Define `Body` enum with rotation periods +- TODO: Define `Epoch` enum and epoch registry +- TODO: Implement core `PlanetaryTime` class +- TODO: Implement conversion from Earth `datetime` +- TODO: Implement `__str__` / `__repr__` +- TODO: Write tests for conversion accuracy +- TODO: Write tests for epoch switching +- TODO: Populate README with usage examples +- TODO: Implement `scripts/refresh_data.py` — fetches rotation periods, orbital periods and discovery dates from Wikidata SPARQL endpoint and regenerates hardcoded data in `body.py`, `moon.py` and `epoch.py`; script is not part of the distributed package diff --git a/pyproject.toml b/pyproject.toml index b11d542..93fc54f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "planetarytime" -version = "1.1.0" +version = "1.2.0" description = "Python library for representing and working with time on other bodies in the Solar System" authors = [ {name = "Jan Doubravský", email = "jan.doubravsky@gmail.com"} diff --git a/src/planetarytime/planetary_time.py b/src/planetarytime/planetary_time.py index e40b739..66135fe 100644 --- a/src/planetarytime/planetary_time.py +++ b/src/planetarytime/planetary_time.py @@ -139,6 +139,16 @@ class PlanetaryTime: """Second within the current minute (0-indexed).""" return self._second + @property + def time(self) -> str: + """Current time of sol as 'HH:MM:SS'.""" + return f"{self._hour:02d}:{self._minute:02d}:{self._second:02d}" + + @property + def date(self) -> str: + """Current date as 'Year X, Sol Y'.""" + return f"Year {self._year}, Sol {self._sol}" + # ------------------------------------------------------------------ # String representation # ------------------------------------------------------------------