fix: keep birthdays and show Shamsi dates
Imported customers keep their birthday, and assistant text plus remaining calendars use the Jalali date. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import { computed, nextTick, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { api } from '@/lib/api';
|
||||
import { formatMoney } from '@/lib/money';
|
||||
import { toFaDigits } from '@/lib/jalali';
|
||||
import { formatJalaliDateTime, rewriteGregorianDates, toFaDigits } from '@/lib/jalali';
|
||||
import HomeHero from '@/components/dashboard/HomeHero.vue';
|
||||
import HomeKpiRow from '@/components/dashboard/HomeKpiRow.vue';
|
||||
import HomeSalesTrend from '@/components/dashboard/HomeSalesTrend.vue';
|
||||
@@ -52,14 +52,9 @@ const greeting = computed(() => {
|
||||
|
||||
function formatWhen(value: string | null) {
|
||||
if (!value) return '';
|
||||
try {
|
||||
return new Intl.DateTimeFormat('fa-IR', {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'short',
|
||||
}).format(new Date(value));
|
||||
} catch {
|
||||
return value;
|
||||
}
|
||||
const d = new Date(value);
|
||||
if (Number.isNaN(d.getTime())) return value;
|
||||
return formatJalaliDateTime(d);
|
||||
}
|
||||
|
||||
function formatKpiValue(key: string, value: number) {
|
||||
@@ -117,7 +112,7 @@ async function submitAsk(preset?: string) {
|
||||
askSources.value = [];
|
||||
try {
|
||||
const { data } = await api.post<AskMentoResponse>('/ai/ask', { question: q });
|
||||
askAnswer.value = data.answer;
|
||||
askAnswer.value = rewriteGregorianDates(data.answer);
|
||||
askSources.value = data.sources ?? [];
|
||||
await nextTick();
|
||||
document
|
||||
|
||||
Reference in New Issue
Block a user