Closed rc2dev closed 1 month ago
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
I opened #981 but was redirected to this original issue, which is related. I have closed the original as it is a duplicate.
While creating a space script function is an acceptable workaround in some cases, where it falls short is that the out-of-the-box Journal features in Library/Core/Journal
use both {{today}}
and {{time}}
in its filename generation, which creates misleading and potentially confusing names.
This is demonstrated here, where the files were created in the order specified in the annotation:
A note created at 9:57 AM AEST (23:57 UTC) and another created at 10:05 AM AEST (00:05 UTC) are created out of order.
So, the issue in my mind isn't that {{time}}
doesn't respect timezones, but that it is used in concert with {{today}}
which does appear to. The dates in the journal should be strictly UTC or strictly local by default.
Ok, I'm now formatting all dates and times to whatever the local setting is. Let's hope this works well. A space reindex may be required for this to take effect.
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:
Running
date
inside the container returns UTC time.I've also tried, with no luck: