i3 / i3status

Generates status bar to use with i3bar, dzen2 or xmobar
BSD 3-Clause "New" or "Revised" License
598 stars 251 forks source link

Correctly format tztime #507

Open fspv opened 1 year ago

fspv commented 1 year ago

The format uses an incorrect source string to replate %time placeholder with the corresponding datetime value, as a result we output a format string instead of formatted value

fspv commented 1 year ago

The problem is described here https://github.com/i3/i3status/issues/491

Testing:

Before

build $ ninja && ./i3status
[3/3] Linking target i3status.
{"version":1}                                                                  
[                                                                              
[{"name":"tztime","instance":"UK","markup":"none","full_text":"%Y-%m-%d %I:%M:%S %P %Z"}]
,[{"name":"tztime","instance":"UK","markup":"none","full_text":"%Y-%m-%d %I:%M:%S %P %Z"}]

After

build $ ninja && ./i3status
[3/3] Linking target i3status.
{"version":1}                                                                  
[                                                                              
[{"name":"tztime","instance":"UK","markup":"none","full_text":"<span color='#00FF00'>2022-11-30 08:14:27 pm GMT</span>"}]
,[{"name":"tztime","instance":"UK","markup":"none","full_text":"<span color='#00FF00'>2022-11-30 08:14:28 pm GMT</span>"}]

Sample config

general {
    output_format = "i3bar"
}

order += "tztime UK"

tztime UK {
    format = "<span color='#00FF00'>%time</span>"
    format_time = "%Y-%m-%d %I:%M:%S %P %Z"
    timezone = "Europe/London"
}
fspv commented 1 year ago

Turns out it has already been reported here as well with exactly the same fix https://github.com/i3/i3status/pull/465

This issue will be 2 years old soon