Skip to content

Commit

Permalink
handle fractional and NaN epochs (#4289)
Browse files Browse the repository at this point in the history
* handle fractional and NaN epochs

* typo & linting

* fix style

* use today()

* fix stylecheck

* remove redundant string()

* move formatter changes to RecipesPipeline

* Apply suggestions from code review

change formatter-variable

Co-authored-by: Simon Christ <SimonChrist@gmx.de>

* add name to contributors

Co-authored-by: Henning Labuhn <henning.labuhn@depixus.com>
Co-authored-by: Simon Christ <SimonChrist@gmx.de>
  • Loading branch information
3 people authored Jul 29, 2022
1 parent 030d70d commit df0c249
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@
{
"name": "Nick OBrien",
"type": "Other"
},
{
"name": "Henning Labuhn",
"type": "Other"
}
],
"upload_type": "software"
Expand Down
6 changes: 3 additions & 3 deletions src/backends/plotly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,11 @@ plotly_native_data(axis::Axis, a::Surface) = Surface(plotly_native_data(axis, a.

function plotly_convert_to_datetime(x::AbstractArray, formatter::Function)
if formatter == datetimeformatter
map(xi -> replace(formatter(xi), "T" => " "), x)
map(xi -> isfinite(xi) ? replace(formatter(xi), "T" => " ") : missing, x)
elseif formatter == dateformatter
map(xi -> string(formatter(xi), " 00:00:00"), x)
map(xi -> isfinite(xi) ? replace(formatter(xi), "T" => " ") : missing, x)
elseif formatter == timeformatter
map(xi -> string(Dates.Date(Dates.now()), " ", formatter(xi)), x)
map(xi -> isfinite(xi) ? string(Dates.today(), " ", formatter(xi)) : missing, x)
else
error(
"Invalid DateTime formatter. Expected Plots.datetime/date/time formatter but got $formatter",
Expand Down

0 comments on commit df0c249

Please sign in to comment.