From 40546406bed72a4127f84e8361e3c3fb1958063b Mon Sep 17 00:00:00 2001 From: Francesco Bruzzesi <42817048+FBruzzesi@users.noreply.github.com> Date: Sat, 26 Aug 2023 12:01:09 +0200 Subject: [PATCH] Hotfix and version bump (#29) --- README.md | 6 +++--- docs/getting-started/quickstart.md | 26 ++++++++++++++++++++++++++ pyproject.toml | 2 +- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index debf4af..a13d3c0 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ In a nutshell it provides: -- [`IsoWeek`](https://fbruzzesi.github.io/api/isoweek.md) and [`IsoWeekDate`](https://fbruzzesi.github.io/api/isoweekdate.md) classes implementing a series of methods to work with ISO Week date formats and avoiding the pitfalls of going back and forth between string, date and datetime python objects. -- [pandas](https://fbruzzesi.github.io/api/pandas.md) and [polars](https://fbruzzesi.github.io/api/polars.md) functionalities to work with series of ISO Week dates. +- [`IsoWeek`](https://fbruzzesi.github.io/iso-week-date/api/isoweek) and [`IsoWeekDate`](https://fbruzzesi.github.io/iso-week-date/api/isoweekdate) classes implementing a series of methods to work with ISO Week date formats and avoiding the pitfalls of going back and forth between string, date and datetime python objects. +- [pandas](https://fbruzzesi.github.io/iso-week-date/api/pandas) and [polars](https://fbruzzesi.github.io/iso-week-date/api/polars) functionalities to work with series of ISO Week dates. --- @@ -108,7 +108,7 @@ To check an example see the [working with custom offset](https://fbruzzesi.githu ## Contributing -Please read the [contributing guidelines](contribute.md) in the documentation site. +Please read the [contributing guidelines](https://fbruzzesi.github.io/iso-week-date/contribute) in the documentation site. ## License diff --git a/docs/getting-started/quickstart.md b/docs/getting-started/quickstart.md index 5c49401..4d588bd 100644 --- a/docs/getting-started/quickstart.md +++ b/docs/getting-started/quickstart.md @@ -268,3 +268,29 @@ class MyWeek(IsoWeek): ``` This is all that is required to work with a custom shifted week. + +Now the same date may be "mapped" to different ISO Weeks depending on the offset: + +```py +_date = date(2023, 1, 1) +IsoWeek.from_date(_date) # IsoWeek(2022-W52) +MyWeek.from_date(_date) # MyWeek(2023-W01) +``` + +Or we can see that the same week starts on different dates: + +```py +IsoWeek("2023-W01").nth(1) # date(2023, 1, 2) +MyWeek("2023-W01").nth(1) # date(2022, 12, 31) +``` + +Similarly we can define a custom offset for the `IsoWeekDate` class: + +```py title="custom offset" +class MyWeekDate(IsoWeekDate): + """ + MyWeekDate class is a IsoWeekDate with custom offset of -2 days. + Therefore MyWeekDate starts the Saturday before the "standard" ISO week. + """ + offset_ = timedelta(days=-2) +``` diff --git a/pyproject.toml b/pyproject.toml index 15a4328..59f50eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "iso-week-date" description = "Toolkit to work with str representing ISO Week date format" -version = "0.0.2" +version = "0.1.0" readme = "README.md" license = {file = "LICENSE"} authors = [{name = "Francesco Bruzzesi"}]