Remove timezone info and replace 'T' delimeter with ' ' (ws).
(iso_string)
| 341 | |
| 342 | |
| 343 | def iso_to_plotly_time_string(iso_string): |
| 344 | """Remove timezone info and replace 'T' delimeter with ' ' (ws).""" |
| 345 | # make sure we don't send timezone info to plotly |
| 346 | if (iso_string.split("-")[:3] == "00:00") or (iso_string.split("+")[0] == "00:00"): |
| 347 | raise Exception( |
| 348 | "Plotly won't accept timestrings with timezone info.\n" |
| 349 | "All timestrings are assumed to be in UTC." |
| 350 | ) |
| 351 | |
| 352 | iso_string = iso_string.replace("-00:00", "").replace("+00:00", "") |
| 353 | |
| 354 | if iso_string.endswith("T00:00:00"): |
| 355 | return iso_string.replace("T00:00:00", "") |
| 356 | else: |
| 357 | return iso_string.replace("T", " ") |
| 358 | |
| 359 | |
| 360 | def template_doc(**names): |
no test coverage detected