ssb-konjunk 0.1.13__tar.gz → 0.1.14__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ssb-konjunk
3
- Version: 0.1.13
3
+ Version: 0.1.14
4
4
  Summary: SSB Konjunk
5
5
  Home-page: https://github.com/statisticsnorway/ssb-konjunk
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ssb-konjunk"
3
- version = "0.1.13"
3
+ version = "0.1.14"
4
4
  description = "SSB Konjunk"
5
5
  authors = ["Edvard Garmannslund <ged@ssb.no>"]
6
6
  license = "MIT"
@@ -335,3 +335,24 @@ def publishing_date() -> str:
335
335
  date = set_publishing_date()
336
336
  ok_date = check_publishing_date(date)
337
337
  return ok_date
338
+
339
+
340
+ def get_previous_month(year: str | int, month: str | int) -> list[int]:
341
+ """Turn e.g. month 01 year 2023 into month 12 and year 2022.
342
+
343
+ Args:
344
+ year: the current year YYYY.
345
+ month: the current month MM.
346
+
347
+ Returns:
348
+ list[int]: the previous month with year.
349
+ """
350
+ prev_month = int(month) - 1
351
+
352
+ if prev_month != 0:
353
+ prev_year = int(year)
354
+ else:
355
+ prev_month = 12
356
+ prev_year = int(year) - 1
357
+
358
+ return [prev_year, prev_month]
File without changes
File without changes