changed date format for publishing/updating articles
This commit is contained in:
parent
3f957f59cb
commit
79bb921cfa
@ -70,7 +70,7 @@ a:focus-visible {
|
|||||||
box-shadow: 0 0 0 0.1rem rgba(var(--text-color), 1) inset;
|
box-shadow: 0 0 0 0.1rem rgba(var(--text-color), 1) inset;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=datetime-local] {
|
input[type=date] {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0.6rem 0.8rem;
|
padding: 0.6rem 0.8rem;
|
||||||
background-color: rgba(var(--text-color), 0.06);
|
background-color: rgba(var(--text-color), 0.06);
|
||||||
@ -80,7 +80,7 @@ input[type=datetime-local] {
|
|||||||
color: inherit;
|
color: inherit;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
}
|
}
|
||||||
input[type=datetime-local]:focus {
|
input[type=date]:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
box-shadow: 0 0 0 0.1rem var(--accent-color);
|
box-shadow: 0 0 0 0.1rem var(--accent-color);
|
||||||
}
|
}
|
||||||
|
|||||||
2
css/main.min.css
vendored
2
css/main.min.css
vendored
File diff suppressed because one or more lines are too long
@ -72,7 +72,7 @@ a {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="datetime-local"] {
|
input[type="date"] {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0.6rem 0.8rem;
|
padding: 0.6rem 0.8rem;
|
||||||
background-color: rgba(var(--text-color), 0.06);
|
background-color: rgba(var(--text-color), 0.06);
|
||||||
|
|||||||
34
index.html
34
index.html
@ -484,7 +484,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<label class="grid gap-0-5">
|
<label class="grid gap-0-5">
|
||||||
<h5>Publishing date</h5>
|
<h5>Publishing date</h5>
|
||||||
<input type="datetime-local" id="edit_published">
|
<input type="date" id="edit_published">
|
||||||
</label>
|
</label>
|
||||||
<div class="flex align-center w-100">
|
<div class="flex align-center w-100">
|
||||||
<button id="set_article_meta" class="button button--primary cta w-100"
|
<button id="set_article_meta" class="button button--primary cta w-100"
|
||||||
@ -1992,7 +1992,7 @@
|
|||||||
floGlobals.appObjects.rmTimes.articles[articleID]['updated'] = Date.now();
|
floGlobals.appObjects.rmTimes.articles[articleID]['updated'] = Date.now();
|
||||||
} else {
|
} else {
|
||||||
floGlobals.appObjects.rmTimes.articles[articleID] = {
|
floGlobals.appObjects.rmTimes.articles[articleID] = {
|
||||||
published: Date.now(),
|
published,
|
||||||
votes: 0,
|
votes: 0,
|
||||||
lastCountedVC: ''
|
lastCountedVC: ''
|
||||||
}
|
}
|
||||||
@ -2106,8 +2106,15 @@
|
|||||||
setSelectedCategories(categories || '');
|
setSelectedCategories(categories || '');
|
||||||
getRef('edit_contributors').value = contributors || [];
|
getRef('edit_contributors').value = contributors || [];
|
||||||
getRef('edit_tags').value = tags || [];
|
getRef('edit_tags').value = tags || [];
|
||||||
const timeToShow = published ? published : Date.now()
|
getRef('edit_published').value = formatDate(published || Date.now())
|
||||||
getRef('edit_published').value = new Date(timeToShow).toISOString().substr(0, new Date(timeToShow).toISOString().indexOf("."))
|
}
|
||||||
|
// format unix timestamp to yyyy-mm-dd
|
||||||
|
function formatDate(unixTimestamp) {
|
||||||
|
const date = new Date(unixTimestamp);
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = date.getMonth() + 1;
|
||||||
|
const day = date.getDate();
|
||||||
|
return `${year}-${month < 10 ? '0' : ''}${month}-${day < 10 ? '0' : ''}${day}`;
|
||||||
}
|
}
|
||||||
function getArticleMetaData() {
|
function getArticleMetaData() {
|
||||||
return {
|
return {
|
||||||
@ -2162,14 +2169,17 @@
|
|||||||
getConfirmation('Update article meta data?').then(async res => {
|
getConfirmation('Update article meta data?').then(async res => {
|
||||||
if (res) {
|
if (res) {
|
||||||
showLoader('UPDATING...')
|
showLoader('UPDATING...')
|
||||||
const { title, categories, summary, published, tags, contributors, heroImage } = getArticleMetaData()
|
// const { title, categories, summary, published, tags, contributors, heroImage } = getArticleMetaData()
|
||||||
floGlobals.appObjects.rmTimes.articles[articleID].categories = categories
|
console.log(getArticleMetaData())
|
||||||
floGlobals.appObjects.rmTimes.articles[articleID].title = title
|
floGlobals.appObjects.rmTimes.articles[articleID] = { ...floGlobals.appObjects.rmTimes.articles[articleID], ...getArticleMetaData() }
|
||||||
floGlobals.appObjects.rmTimes.articles[articleID].tags = tags
|
console.log(floGlobals.appObjects.rmTimes.articles[articleID].published)
|
||||||
floGlobals.appObjects.rmTimes.articles[articleID].summary = summary
|
// floGlobals.appObjects.rmTimes.articles[articleID].categories = categories
|
||||||
floGlobals.appObjects.rmTimes.articles[articleID].contributors = contributors
|
// floGlobals.appObjects.rmTimes.articles[articleID].title = title
|
||||||
floGlobals.appObjects.rmTimes.articles[articleID].heroImage = heroImage
|
// floGlobals.appObjects.rmTimes.articles[articleID].tags = tags
|
||||||
floGlobals.appObjects.rmTimes.articles[articleID].published = published
|
// floGlobals.appObjects.rmTimes.articles[articleID].summary = summary
|
||||||
|
// floGlobals.appObjects.rmTimes.articles[articleID].contributors = contributors
|
||||||
|
// floGlobals.appObjects.rmTimes.articles[articleID].heroImage = heroImage
|
||||||
|
// floGlobals.appObjects.rmTimes.articles[articleID].published = published
|
||||||
// if (heroImage.hasOwnProperty('full')) {
|
// if (heroImage.hasOwnProperty('full')) {
|
||||||
// try {
|
// try {
|
||||||
// compactIDB.writeData('images', { heroImage }, articleID)
|
// compactIDB.writeData('images', { heroImage }, articleID)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user