Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix history-compact.vue error on parsing date. #9794

Merged
merged 5 commits into from
Aug 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions themes-default/slim/src/components/history-compact.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@
<img style="margin-right: 5px;"
:src="`images/providers/${row.provider.imageName}`"
:alt="row.provider.name" width="16" height="16"
v-tooltip.right="`${row.provider.name}: ${row.resource} (${row.actionDate})`"
v-tooltip.right="`${row.provider.name}: ${row.resource} (${fuzzyParseDateTime(convertDateFormat(row.actionDate))})`"
onError="this.onerror=null;this.src='images/providers/missing.png';"
>
<img v-if="row.manuallySearched" src="images/manualsearch.png" width="16" height="16" style="vertical-align:middle;" v-tooltip.right="`Manual searched episode: ${row.resource} (${row.actionDate})`">
<img v-if="row.properTags" src="images/info32.png" width="16" height="16" style="vertical-align:middle;" v-tooltip.right="`${row.properTags.split(/[ |]+/).join(', ')}: ${row.resource} (${row.actionDate})`">
<img v-if="row.manuallySearched" src="images/manualsearch.png" width="16" height="16" style="vertical-align:middle;" v-tooltip.right="`Manual searched episode: ${row.resource} (${fuzzyParseDateTime(convertDateFormat(row.actionDate))})`">
<img v-if="row.properTags" src="images/info32.png" width="16" height="16" style="vertical-align:middle;" v-tooltip.right="`${row.properTags.split(/[ |]+/).join(', ')}: ${row.resource} (${fuzzyParseDateTime(convertDateFormat(row.actionDate))})`">

</template>
<img v-else-if="row.statusName ==='Failed'" src="images/no16.png"
width="16" height="16" style="vertical-align:middle;"
v-tooltip.right="`${row.provider.name} download failed: ${row.resource} (${fuzzyParseDateTime(row.actionDate)})`"
v-tooltip.right="`${row.provider.name} download failed: ${row.resource} (${fuzzyParseDateTime(convertDateFormat(row.actionDate))})`"
>
</div>
</span>
Expand Down Expand Up @@ -107,6 +107,8 @@ import { manageCookieMixin } from '../mixins/manage-cookie';
import QualityPill from './helpers/quality-pill.vue';
import AppLink from './helpers/app-link.vue';
import { VTooltip } from 'v-tooltip';
import parse from 'date-fns/parse';
import formatDate from 'date-fns/format';

export default {
name: 'history-compact',
Expand Down Expand Up @@ -291,6 +293,15 @@ export default {
const { getHistory } = this;
console.log(this.serverParams);
getHistory(this.serverParams);
},
/**
* Re-format date.
* @param {number} date - Date formatted as a number.
* @returns {string} - Formatted date as a string.
*/
convertDateFormat(date) {
const dateObj = parse(date, 'yyyyMMddHHmmss', new Date()); // Example: 20210813162256
return formatDate(dateObj, 'yyyy-MM-dd HH:mm:ss');
}
}
};
Expand Down
1 change: 0 additions & 1 deletion themes-default/slim/src/store/modules/config/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ const getters = {

// Only the history page should show seconds.
const formatTimeStyle = showSeconds ? timeStyle : timeStyle.replace(':%S', '');

const fdate = parseISO(airDate);
return formatDate(fdate, convertDateFormat(`${dateStyle} ${formatTimeStyle}`));
},
Expand Down
Loading