File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -8,3 +8,5 @@ TOGGL_USER_INFO=data/toggl-user-info-sample.json
88TOGGL_API_TOKEN = token
99TOGGL_CLIENT_ID = client
1010TOGGL_WORKSPACE_ID = workspace
11+
12+ TZ_NAME = America/Los_Angeles
Original file line number Diff line number Diff line change 11from argparse import ArgumentParser , _SubParsersAction
2+ from datetime import datetime , timedelta
3+ import os
24import sys
5+ from zoneinfo import ZoneInfo
36
47from compiler_admin import __version__ as version
58from compiler_admin .commands .info import info
912from compiler_admin .commands .user .convert import ACCOUNT_TYPE_OU
1013
1114
15+ TZINFO = ZoneInfo (os .environ .get ("TZ_NAME" , "America/Los_Angeles" ))
16+
17+
18+ def local_now ():
19+ return datetime .now (tz = TZINFO )
20+
21+
22+ def prior_month_end ():
23+ now = local_now ()
24+ first = now .replace (day = 1 )
25+ return first - timedelta (days = 1 )
26+
27+
28+ def prior_month_start ():
29+ end = prior_month_end ()
30+ return end .replace (day = 1 )
31+
32+
1233def add_sub_cmd_parser (parser : ArgumentParser , dest = "subcommand" , help = None ):
1334 """Helper adds a subparser for the given dest."""
1435 return parser .add_subparsers (dest = dest , help = help )
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ requires-python = ">=3.11"
1313dependencies = [
1414 " advanced-gam-for-google-workspace @ git+https://github.com/taers232c/GAMADV-XTD3.git@v7.00.05#subdirectory=src" ,
1515 " pandas==2.2.3" ,
16+ " tzdata" ,
1617]
1718
1819[project .urls ]
You can’t perform that action at this time.
0 commit comments