openfree commited on
Commit
d90e90d
โ€ข
1 Parent(s): b6d32cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -6,10 +6,22 @@ import random
6
  USERNAME = "openfree"
7
 
8
  def format_timestamp(timestamp):
9
- if timestamp:
10
- dt = datetime.fromisoformat(timestamp.replace('Z', '+00:00'))
 
 
 
 
 
 
 
 
 
11
  return dt.strftime('%Y-%m-%d %H:%M')
12
- return 'N/A'
 
 
 
13
 
14
  def should_exclude_space(space_name):
15
  """ํŠน์ • ์ŠคํŽ˜์ด์Šค๋ฅผ ์ œ์™ธํ•˜๋Š” ํ•„ํ„ฐ ํ•จ์ˆ˜"""
 
6
  USERNAME = "openfree"
7
 
8
  def format_timestamp(timestamp):
9
+ if not timestamp:
10
+ return 'N/A'
11
+ try:
12
+ # ๋ฌธ์ž์—ด์ธ ๊ฒฝ์šฐ
13
+ if isinstance(timestamp, str):
14
+ dt = datetime.fromisoformat(timestamp.replace('Z', '+00:00'))
15
+ # ์ •์ˆ˜(๋ฐ€๋ฆฌ์ดˆ)์ธ ๊ฒฝ์šฐ
16
+ elif isinstance(timestamp, (int, float)):
17
+ dt = datetime.fromtimestamp(timestamp / 1000) # ๋ฐ€๋ฆฌ์ดˆ๋ฅผ ์ดˆ๋กœ ๋ณ€ํ™˜
18
+ else:
19
+ return 'N/A'
20
  return dt.strftime('%Y-%m-%d %H:%M')
21
+ except Exception as e:
22
+ print(f"Timestamp conversion error: {str(e)} for timestamp: {timestamp}")
23
+ return 'N/A'
24
+
25
 
26
  def should_exclude_space(space_name):
27
  """ํŠน์ • ์ŠคํŽ˜์ด์Šค๋ฅผ ์ œ์™ธํ•˜๋Š” ํ•„ํ„ฐ ํ•จ์ˆ˜"""