Hello team,
i want modify the post data format to YYYY-MM-DD HH:mm
Modifying in frontend javascript doesn’t seem reasonable
1.Can I use a theme to override this time?
2.how can i modify this in the email too(now it only display data)
All the date formats are available to customize along with other text. Check out this guide:
thanks for your reply, David
I saw this custom setting, but it seems that I don’t find it here.
I want to display the time format of all posts as absolute time. For example, the current my topic post ‘3h’ is displayed as ‘12 May 17:33’
do you know what is the best way for me to change all post data to the YYYY-MM-DD HH:mm format, even it post in some minutes
Ah I see!
In that case, you could try changing the “relative date duration” site setting.
relative_date_duration: Number of days after posting where post dates will be shown as relative (7d) instead of absolute (20 Feb).
So I think for your case, you would set it to 0
כן,
אני הגדרתי את זה ל-0, אבל זה עדיין לא משפיע כעת. זה לוקח קצת זמן או שאני צריך לכתוב rake posts:rebake כמו שאנחנו עושים לאחר שינוי דומיין?
זה אמור לדרוש רק רענון של הדף כדי שהשינויים ייכנסו לתוקף. זה עשה כל שינוי שהוא? איך נראהות תאריכי הפוסטים שלך עכשיו?
Hmm, it seems like dates which are less than 23.5 hours ago are always shown as relative, regardless of that setting:
So, your change to the setting will have applied to posts more than 1 day old. But it doesn’t look like we currently have a way to change the behaviour of things which are less than a day old.
i see this file
discourse-main/app/assets/javascripts/discourse/app/components/post/meta-data/date.gjs
<template>
<div class="post-info post-date">
<a
class={{concatClass
"post-date"
(if (and @post.wiki @post.last_wiki_edit) "last-wiki-edit")
}}
href={{@post.shareUrl}}
title={{i18n "post.sr_date"}}
{{on "click" this.showShareModal}}
>
<RelativeDate @date={{this.date}} />
</a>
</div>
</template>
is this the correct template, can i change it by a theme component?
לא, אתה לא יכול להחליף תבניות .gjs, למרבה הצער (מתוכנן לשפר ולעודד יציבות של ההחלפות)
ברוך שבך. @aksoforever!
איך אתה מתקדם עם זה? האם תוכל לספר לנו עוד על מקרה השימוש שלך?
מדוע תרצה להטיל תאריכים כה ארוכים וכוללים על החברים שלך? התאריכים “לפני כמה זמן” הם ידידותיים לעין ומעבירים את המידע שאתה צריך כדי לדעת כמה ישן הפוסט. כאשר מנווטים מעליהם, מוצגים התאריכים המדויקים.
תודה על תשומת הלב @tobiaseigen
כן, כעת התצוגה של Discourse מאוד מודרנית וידידותית למשתמש, ומתאימה יותר לרוב האנשים
רק למספר קטן של אנשים שמנצלים אותה תדיר, ההכרזה על זמן מוחלט מרגישה מהירה וחשופה יותר.
בנוגע לזמן באימייל, הוא כעת מציג רק את החודש והיום.
זה לא נוח להשתמש בדואר אלקטרוני לצפייה במידע. זה לא מציג את השנה, במיוחד כשעושים סקירה של מידע מימי העבר.
אני משתמש כעת בגירסה מופחתת של Discourse ומכתוב מחדש את קוד ה- front-end באמצעות רכיבים
האם אפשר לשנות את short_date מרכיב תבנית?
לאחראתחול do
אם SiteSetting.custom_email_date_format_enabled
מודול ::EmailHelper
def short_date(datetime)
זמן סין = datetime.in_time_zone("Asia/Shanghai")
זמן סין.strftime("%Y-%m-%d %H:%M")
end
end
סיום
סיום


