Fix date formatting to use UTC
This commit is contained in:
@@ -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 ''
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user