diff --git a/README.md b/README.md index 9ba9ab7..f0cb68e 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,15 @@ for ym in YearMonth.range(ym1, ym2): print(ym) # 2019-01, 2019-02, 2019-03 ``` +Calculate the distance between two year-months: + +```python +ym1 = YearMonth(2019, 1) +ym2 = YearMonth(2019, 3) + +distance = ym1.distance_to(ym2) # 2 +``` + ## License mp-yearmonth is licensed under the MIT license. See [LICENSE](https://github.com/raymondjavaxx/mp-yearmonth/blob/main/LICENSE) for details.