Fix date formatting to use UTC

This commit is contained in:
Deluan
2023-05-24 14:47:51 -04:00
parent e38a690632
commit ba067667c9
6 changed files with 38 additions and 38 deletions
-29
View File
@@ -1,29 +0,0 @@
export const FormatFullDate = (date) => {
const dashes = date.split('-').length - 1
let options = {
year: 'numeric',
}
switch (dashes) {
case 2:
options = {
year: 'numeric',
month: 'long',
day: 'numeric',
}
return new Date(date).toLocaleDateString(undefined, options)
case 1:
options = {
year: 'numeric',
month: 'long',
}
return new Date(date).toLocaleDateString(undefined, options)
case 0:
if (date.length === 4) {
return new Date(date).toLocaleDateString(undefined, options)
} else {
return ''
}
default:
return ''
}
}
+3 -2
View File
@@ -18,8 +18,9 @@ import AlbumIcon from '@material-ui/icons/Album'
import clsx from 'clsx'
import { useDrag } from 'react-dnd'
import { playTracks } from '../actions'
import { AlbumContextMenu, FormatFullDate } from '../common'
import { AlbumContextMenu } from '../common'
import { DraggableTypes } from '../consts'
import { formatFullDate } from '../utils'
const useStyles = makeStyles({
subtitle: {
@@ -66,7 +67,7 @@ const ReleaseRow = forwardRef(
let releaseTitle = []
if (record.releaseDate) {
releaseTitle.push(translate('resources.album.fields.released'))
releaseTitle.push(FormatFullDate(record.releaseDate))
releaseTitle.push(formatFullDate(record.releaseDate))
if (record.catalogNum && isDesktop) {
releaseTitle.push('· Cat #')
releaseTitle.push(record.catalogNum)
-1
View File
@@ -4,7 +4,6 @@ export * from './BatchPlayButton'
export * from './BitrateField'
export * from './ContextMenus'
export * from './DateField'
export * from './FormatFullDate'
export * from './DocLink'
export * from './DurationField'
export * from './List'