replcae pm am with none if not enabled

This commit is contained in:
Justin 2023-08-22 22:38:34 +08:00 committed by GitHub
parent 14f5dd97b1
commit c34f8f4261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,18 +62,18 @@ def getTimes(timezone):
elif settings['display_pm'] and not settings['display_seconds']: elif settings['display_pm'] and not settings['display_seconds']:
time = datetime.now(timezone).strftime("%I:%M %p") time = datetime.now(timezone).strftime("%I:%M %p")
elif not settings['display_pm'] and settings['display_seconds']: elif not settings['display_pm'] and settings['display_seconds']:
time = datetime.now(timezone).strftime("%I:%M:%S") time = datetime.now(timezone).strftime("%I:%M:%S %p")
else: else:
time = datetime.now(timezone).strftime("%I:%M") time = datetime.now(timezone).strftime("%I:%M %p")
else: else:
if settings['display_pm'] and settings['display_seconds']: if settings['display_pm'] and settings['display_seconds']:
time = datetime.now(timezone).strftime("%H:%M:%S %p") time = datetime.now(timezone).strftime("%H:%M:%S %p")
elif settings['display_pm'] and not settings['display_seconds']: elif settings['display_pm'] and not settings['display_seconds']:
time = datetime.now(timezone).strftime("%H:%M %p") time = datetime.now(timezone).strftime("%H:%M %p")
elif not settings['display_pm'] and settings['display_seconds']: elif not settings['display_pm'] and settings['display_seconds']:
time = datetime.now(timezone).strftime("%H:%M:%S") time = datetime.now(timezone).strftime("%H:%M:%S %p")
else: else:
time = datetime.now(timezone).strftime("%H:%M") time = datetime.now(timezone).strftime("%H:%M %p")
return time return time
@ -137,6 +137,10 @@ while True:
london_time = getTimes(london_timezone) london_time = getTimes(london_timezone)
#TOKYO TIME #TOKYO TIME
tokyo_time = getTimes(tokyo_timezone) tokyo_time = getTimes(tokyo_timezone)
if not settings['display_pm']:
ny_time = ny_time.replace("PM", "").replace("AM", "")
london_time = london_time.replace("PM", "").replace("AM", "")
tokyo_time = tokyo_time.replace("PM", "").replace("AM", "")
ny_color = time_colors['day'] if isDaytime(ny_time) else time_colors['night'] ny_color = time_colors['day'] if isDaytime(ny_time) else time_colors['night']
london_color = time_colors['day'] if isDaytime(london_time) else time_colors['night'] london_color = time_colors['day'] if isDaytime(london_time) else time_colors['night']
@ -163,7 +167,11 @@ while True:
dubai_time = getTimes(dubai_timezone) dubai_time = getTimes(dubai_timezone)
#LOS ANGELES #LOS ANGELES
la_time = getTimes(la_timezone) la_time = getTimes(la_timezone)
if not settings['display_pm']:
au_time = au_time.replace("PM", "").replace("AM", "")
dubai_time = dubai_time.replace("PM", "").replace("AM", "")
la_time = la_time.replace("PM", "").replace("AM", "")
au_color = time_colors['day'] if isDaytime(au_time) else time_colors['night'] au_color = time_colors['day'] if isDaytime(au_time) else time_colors['night']
dubai_color = time_colors['day'] if isDaytime(dubai_time) else time_colors['night'] dubai_color = time_colors['day'] if isDaytime(dubai_time) else time_colors['night']
la_color = time_colors['day'] if isDaytime(la_time) else time_colors['night'] la_color = time_colors['day'] if isDaytime(la_time) else time_colors['night']
@ -189,6 +197,10 @@ while True:
paris_time = getTimes(paris_timezone) paris_time = getTimes(paris_timezone)
#MUMBAI #MUMBAI
in_time = getTimes(in_timezone) in_time = getTimes(in_timezone)
if not settings['display_pm']:
cn_time = cn_time.replace("PM", "").replace("AM", "")
paris_time = paris_time.replace("PM", "").replace("AM", "")
in_time = in_time.replace("PM", "").replace("AM", "")
cn_color = time_colors['day'] if isDaytime(cn_time) else time_colors['night'] cn_color = time_colors['day'] if isDaytime(cn_time) else time_colors['night']
paris_color = time_colors['day'] if isDaytime(paris_time) else time_colors['night'] paris_color = time_colors['day'] if isDaytime(paris_time) else time_colors['night']