Skip to content

Commit

Permalink
clean up old Bokeh NaT usage (#6890)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximlt authored Jun 5, 2024
1 parent 8e9076c commit 68749eb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions panel/models/tabulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function group_data(records: any[], columns: any[], indexes: string[], aggregato
}

const timestampSorter = function(a: any, b: any, _aRow: any, _bRow: any, _column: any, _dir: any, _params: any) {
// Bokeh serializes datetime objects as UNIX timestamps.
// Bokeh/Panel serializes datetime objects as UNIX timestamps (in milliseconds).

//a, b - the two values being compared
//aRow, bRow - the row components for the values being compared (useful if you need to access additional fields in the row data for the sort)
Expand All @@ -163,14 +163,12 @@ const timestampSorter = function(a: any, b: any, _aRow: any, _bRow: any, _column

const opts = {zone: new (window as any).luxon.IANAZone("UTC")}

// NaN values are serialized to -9223372036854776 by Bokeh

if (String(a) == "-9223372036854776") {
if (Number.isNaN(a)) {
a = (window as any).luxon.DateTime.fromISO("invalid")
} else {
a = (window as any).luxon.DateTime.fromMillis(a, opts)
}
if (String(b) == "-9223372036854776") {
if (Number.isNaN(b)) {
b = (window as any).luxon.DateTime.fromISO("invalid")
} else {
b = (window as any).luxon.DateTime.fromMillis(b, opts)
Expand Down

0 comments on commit 68749eb

Please sign in to comment.