Merge pull request #64 from ryul1206/fix-week-start

Fix #63: The week_start is different from WakaTime
This commit is contained in:
Jovial Joe Jayarson
2021-06-23 15:27:38 +05:30
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@@ -153,7 +153,7 @@ Since this project is contained all within one file, 'main.py'. You can simply a
`SHOW_TITLE` flag can be set to true if you want to display the week number and days in the readme, by default it will be false. Here is an example output with `SHOW_TITLE` set to true. `SHOW_TITLE` flag can be set to true if you want to display the week number and days in the readme, by default it will be false. Here is an example output with `SHOW_TITLE` set to true.
```text ```text
Week: 10 July, 2020 - 17 July, 2020 Week: 11 July, 2020 - 17 July, 2020
Python 8 hrs 52 mins ███████████████████░░░░░░ 75.87 % Python 8 hrs 52 mins ███████████████████░░░░░░ 75.87 %
Go 1 hr 15 mins ██░░░░░░░░░░░░░░░░░░░░░░░ 10.79 % Go 1 hr 15 mins ██░░░░░░░░░░░░░░░░░░░░░░░ 10.79 %
Markdown 52 mins █░░░░░░░░░░░░░░░░░░░░░░░░ 07.43 % Markdown 52 mins █░░░░░░░░░░░░░░░░░░░░░░░░ 07.43 %

View File

@@ -27,7 +27,7 @@ blocks = os.getenv("INPUT_BLOCKS")
def this_week() -> str: def this_week() -> str:
'''Returns a week streak''' '''Returns a week streak'''
week_end = datetime.datetime.today() - datetime.timedelta(days=1) week_end = datetime.datetime.today() - datetime.timedelta(days=1)
week_start = week_end - datetime.timedelta(days=7) week_start = week_end - datetime.timedelta(days=6)
print("Week header created") print("Week header created")
return f"Week: {week_start.strftime('%d %B, %Y')} - {week_end.strftime('%d %B, %Y')}" return f"Week: {week_start.strftime('%d %B, %Y')} - {week_end.strftime('%d %B, %Y')}"