Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: fix create date issue #68

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Change `config.yaml` to fit your needs.

### Usage as a CLI command


If you want to execute the program using your GCP user credentials, use the commands below:

```bash
gcloud auth application-default login
gcloud config set project PROJECT_ID
Expand Down
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ def _get_organization(client_v1, project):
def _get_created_days_ago(project):
now = dt.now()
create_time = project.get('createTime')
create_time_fixed = str.split(create_time, ".")
create_time_fixed = str.split(create_time_fixed[0], "Z")
create_time_fixed = create_time_fixed[0] + ".000Z"
create_time = create_time_fixed
create_date_value = dt.strptime(create_time, "%Y-%m-%dT%H:%M:%S.%fZ")
delta = now - create_date_value
return delta.days
Expand Down