willasm / vc-weather

MIT License
16 stars 0 forks source link

Use local time for macro expansion #5

Closed Accelsnow closed 1 month ago

Accelsnow commented 1 month ago

This might be more of a feature request rather than a bug?

When the current weather macro gets expanded, it seems like it does not use local time for expansion. For example, my local time (Toronto time) is already past midnight (09-18 Wednesday), but when I expand my macro, the today gets expanded to Tuesday still.

image image

Similarly, the status bar weather also shows weather for 09-17 Tuesday:

image image

In plugin configuration I set weather fetch interval to be 5 minutes, and it seems like even with 5-min update interval it is not updating to the new day, so I guess it has to do with how vc-weather determines "today" (maybe by UTC time? Im not sure)

Obsidian v1.6.7 Plugin v0.1.4

willasm commented 1 month ago

Yes I need to clarify that in the readme. The time you are seeing is the time of the last update to the weather and depending on how often the stations update in your area it can be off from the current time by quite a lot. Here in Edmonton it can be off by well over a half hour at times. I will add macros for the current time as well as that would make more sense to insert that into your notes. I'll post back here as soon as that is done.

Thanks, William

willasm commented 1 month ago

Sorry for the delay, I wanted to complete the new weather alerts feature before creating a new release and that took a littrle longer than expected. Available in v0.2.0

The new current Date and Time macros are...

Macro Description Replaced With Example
%year1-now% Expands to the current year long 2024
%year2-now% Expands to current year short 24
%month1-now% Expands to current month 1 - 12
%month2-now% Expands to current month 01 - 12
%month3-now% Expands to current month Jan
%month4-now% Expands to current month January
%date1-now% Expands to current month 1 - 31
%date2-now% Expands to current month 01 - 31
%dow1-now% Expands to current day of the week Sun
%dow2-now% Expands to current day of the week Sunday
%hours24-now% Current 24 hours 00 to 23, 1:00am = 13
%hours12-now% Current 12 hours 12 hours format
%mins-now% Current minutes 00 - 59
%secs-now% Current seconds 00 - 59
%ampm1-now% AM or PM for 12 hour time AM or PM
%ampm2-now% am or pm for 12 hour time am or pm

I also updated a couple of the default templates to take advantage of these. If you are using the default ones, I suggest resetting them. You can do that by opening the data.json settings file for this plugin and deleteing all the template key/value lines then open the plugins settings in Obsidian and make any change (Toggle statusbar off/on for example) and Obsidian will re-create all the missing settings.

Accelsnow commented 1 month ago

can confirm this works! Thanks William ❤