silverbullet
silverbullet copied to clipboard
Timezone ignored on Docker container
First of all, thanks for Silverbullet!
I have a command to create a note with name "{{ today }} {{ time }}"
. However, time is UTC instead of local.
My compose.yaml:
services:
silverbullet:
image: zefhemel/silverbullet
container_name: silverbullet
restart: unless-stopped
environment:
- SB_USER=${USERNAME}:${PASSWORD}
- PGID=1000
- PUID=1000
- TZ=America/Sao_Paulo
volumes:
- /mnt/dietpi_userdata/silverbullet:/space
networks:
- proxy-net
networks:
proxy-net:
external: true
Running date
inside the container returns UTC time.
I've also tried, with no luck:
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
More info: {{ today }}
seems to respect timezone fine, while {{ time }}
doesn't.
I encountered the same problem
I don't think this is a docker issue, it's indeed a UTC issue. The current time
function gives you UTC time, you can define a space function that gives you the local time. Try this:
Somewhere in your space:
```space-script
silverbullet.registerFunction({name: "localTime"}, () => Temporal.Now.plainTimeISO().toString().split('.')[0])
```
Then call it somewhere:
```template
{{localTime}}
```
I don't think this is a docker issue, it's indeed a UTC issue. The current
time
function gives you UTC time, you can define a space function that gives you the local time. Try this:Somewhere in your space: ```space-script silverbullet.registerFunction({name: "localTime"}, () => Temporal.Now.plainTimeISO().toString().split('.')[0])
Then call it somewhere:
{{localTime}}
This is useful for me, thank you very much