feat(time): Show module with time range (#992)

* Creation of range field in TimeConfig

* time_range parsing

* Hide time module if outside of time_range

* Tidying of code, and properly handling more cases

* is_inside_time_range function

* Tests and fmt

* Update docs

* The configuration needs the 24-hours format

* Fix clippy errors
This commit is contained in:
Samuele Esposito
2020-05-31 19:43:08 +02:00
committed by GitHub
parent ab1c3d1c54
commit fe2b3d491e
3 changed files with 157 additions and 3 deletions
+4 -2
View File
@@ -1327,11 +1327,12 @@ To enable it, set `disabled` to `false` in your configuration file.
| Variable | Default | Description |
| ----------------- | --------------- | ------------------------------------------------------------------------------------------------------------------- |
| `use_12hr` | `false` | Enables 12 hour formatting |
| `use_12hr` | `false` | Enables 12 hour formatting. |
| `format` | see below | The [chrono format string](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html) used to format the time. |
| `style` | `"bold yellow"` | The style for the module time |
| `style` | `"bold yellow"` | The style for the module time. |
| `utc_time_offset` | `"local"` | Sets the UTC offset to use. Range from -24 < x < 24. Allows floats to accommodate 30/45 minute timezone offsets. |
| `disabled` | `true` | Disables the `time` module. |
| `time_range` | `"-"` | Sets the time range during which the module will be shown. Times must be specified in 24-hours format |
If `use_12hr` is `true`, then `format` defaults to `"%r"`. Otherwise, it defaults to `"%T"`.
Manually setting `format` will override the `use_12hr` setting.
@@ -1345,6 +1346,7 @@ Manually setting `format` will override the `use_12hr` setting.
disabled = false
format = "🕙[ %T ]"
utc_time_offset = "-5"
time_range = "10:00:00-14:00:00"
```
## Username