Skip to content

Commit

Permalink
Fix timezone for pasted text
Browse files Browse the repository at this point in the history
  • Loading branch information
rexruan committed Aug 26, 2024
1 parent 3b8e075 commit 8b6eb65
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/lib/load_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re
import tempfile
import pytz
from collections import OrderedDict
from datetime import datetime
from pathlib import Path
Expand Down Expand Up @@ -160,7 +161,8 @@ def run_swegram(language: str, **kwargs) -> List[Dict[str, Any]]:
texts: List[Text] = load_dir(
input_dir=Path(output_dir), language=language, include_tags=[], exclude_tags=[], parsed=parse
)
filename = kwargs.get("filename", f"Pasted at {str(datetime.now())}")
timestamp = datetime.now(tz=pytz.timezone("Europe/Stockholm")).strftime("%Y-%m-%d %H:%M:%S")
filename = kwargs.get("filename", f"Pasted at {timestamp}")
return [{
**_serialize_item(text), **states, "filename": generate_filename(filename, index)}
for index, text in enumerate(texts, 1)
Expand Down

0 comments on commit 8b6eb65

Please sign in to comment.