fix dates not displaying properly
This commit is contained in:
parent
76834845a3
commit
839e1d7124
@ -1,4 +1,5 @@
|
||||
# v0.9.13
|
||||
- Fix dates not rendering properly in table
|
||||
- Update deps
|
||||
|
||||
# v0.9.12
|
||||
|
@ -1,7 +1,7 @@
|
||||
export default {
|
||||
displayDate (el) {
|
||||
const date =
|
||||
Intl.DateTimeFormat([], { timeZone: 'Etc/UTC', dateStyle: 'short' })
|
||||
Intl.DateTimeFormat([], { timeZone: 'UTC', dateStyle: 'short' })
|
||||
.format(new Date(el.dateTime))
|
||||
|
||||
el.innerText = date
|
||||
|
@ -1,7 +1,7 @@
|
||||
export default {
|
||||
displayDateTime (el) {
|
||||
const date =
|
||||
Intl.DateTimeFormat([], { dateStyle: 'short', timeStyle: 'long' })
|
||||
Intl.DateTimeFormat([], { timeZone: 'UTC', dateStyle: 'short', timeStyle: 'long' })
|
||||
.format(new Date(el.dateTime))
|
||||
|
||||
el.innerText = date
|
||||
|
@ -20,6 +20,7 @@ defmodule CanneryWeb.Components.TableComponent do
|
||||
"""
|
||||
|
||||
use CanneryWeb, :live_component
|
||||
alias Cannery.{ComparableDate, ComparableDateTime}
|
||||
alias Phoenix.LiveView.Socket
|
||||
require Integer
|
||||
|
||||
@ -110,7 +111,7 @@ defmodule CanneryWeb.Components.TableComponent do
|
||||
end
|
||||
|
||||
defp sort_by_custom_sort_value_or_value(rows, key, sort_mode, type)
|
||||
when type in [Date, DateTime] do
|
||||
when type in [ComparableDate, ComparableDateTime, Date, DateTime] do
|
||||
rows
|
||||
|> Enum.sort_by(
|
||||
fn row ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user