mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Merge branch 'dev' of https://github.com/Portabase/portabase into dev
This commit is contained in:
@@ -55,7 +55,7 @@ export function DateTimePicker({ name }: DateTimePickerProps) {
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<Button variant="outline" className={cn("w-full pl-3 text-left font-normal", !value && "text-muted-foreground")}>
|
||||
{value ? format(value, "MM/dd/yyyy hh:mm aa") : <span>MM/DD/YYYY hh:mm aa</span>}
|
||||
{value ? format(value, "dd/MM/yyyy hh:mm aa") : <span>DD/MM/YYYY hh:mm aa</span>}
|
||||
<CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
|
||||
@@ -92,7 +92,7 @@ function getOldestLog(logs: HealthcheckLog[]): HealthcheckLog {
|
||||
}
|
||||
|
||||
function formatTime(date: Date): string {
|
||||
return date.toLocaleTimeString("en-US", {
|
||||
return date.toLocaleTimeString("en-GB", {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
OrganizationMemberChangeRoleModal
|
||||
} from "@/features/organizations/components/organization-member-change-role";
|
||||
import {MemberWithUser, OrganizationWithMembersAndUsers} from "@/db/schema/03_organization";
|
||||
import {formatDayOnly} from "@/utils/date-formatting";
|
||||
|
||||
type OrganizationMemberCardProps = {
|
||||
member: MemberWithUser;
|
||||
@@ -56,7 +57,7 @@ export const OrganizationMemberCard = ({member, organization}: OrganizationMembe
|
||||
<div className="font-medium">{member.user.name}</div>
|
||||
<div className="text-sm text-muted-foreground">{member.user.email}</div>
|
||||
<div
|
||||
className="text-xs text-muted-foreground">Joined {new Date(member.createdAt).toLocaleDateString()}</div>
|
||||
className="text-xs text-muted-foreground">Joined {formatDayOnly(member.createdAt)}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2 mt-4 md:mt-0">
|
||||
|
||||
@@ -44,7 +44,6 @@ import { Account, Session, User } from "@/db/schema/02_user";
|
||||
import { Icon } from "@iconify/react";
|
||||
import Image from "next/image";
|
||||
import type { AuthProviderConfig } from "@/lib/auth/config";
|
||||
import { is } from "date-fns/locale";
|
||||
|
||||
interface ProfileSecurityProps {
|
||||
user: User;
|
||||
|
||||
@@ -6,6 +6,7 @@ import {Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter} from "@/
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import type {RestorePreviewRow} from "@/features/database/actions/bulk-restore.action";
|
||||
import {formatLocalizedDate} from "@/utils/date-formatting";
|
||||
|
||||
const CONFIRM_WORD = "restore";
|
||||
|
||||
@@ -54,7 +55,7 @@ export const BulkRestoreModal = (props: BulkRestoreModalProps) => {
|
||||
<td className={`p-2 ${r.restorable ? "" : "opacity-50"}`}>{r.name}</td>
|
||||
<td className="p-2">
|
||||
{r.restorable
|
||||
? <span className="text-green-600">{r.backupDate ? new Date(r.backupDate).toLocaleString() : "latest backup"}</span>
|
||||
? <span className="text-green-600">{r.backupDate ? formatLocalizedDate(r.backupDate) : "latest backup"}</span>
|
||||
: <span className="text-amber-500">{r.reason ?? "no successful backup"} — skipped</span>}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -10,6 +10,5 @@ export const OTLP_AUTH_TOKEN =
|
||||
export function getOtlpEndpoint(): string {
|
||||
return process.env.NODE_ENV === "production"
|
||||
? "https://telemetry.portabase.io"
|
||||
// : "http://localhost:4318";
|
||||
: "https://sandbox.telemetry.portabase.io";
|
||||
: "http://localhost:4318"
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ const level = (process.env.LOG_LEVEL ?? defaultLevel) as pino.Level;
|
||||
function getLocalTimestamp() {
|
||||
const date = new Date();
|
||||
|
||||
const formatted = new Intl.DateTimeFormat("en-US", {
|
||||
const formatted = new Intl.DateTimeFormat("en-GB", {
|
||||
timeZone: process.env.TZ,
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
import {formatDistanceToNow} from "date-fns";
|
||||
|
||||
/**
|
||||
* Get user's locale and timezone from the browser
|
||||
* Detect the user's timezone from the browser (or server during SSR fallback).
|
||||
*/
|
||||
const TIMEZONE = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
const LOCALE = Intl.DateTimeFormat().resolvedOptions().locale;
|
||||
|
||||
/**
|
||||
* Format a date in DD/MM/YYYY HH:mm 24-hour format
|
||||
* Format a date to DD/MM/YYYY HH:mm in 24-hour format using the en-GB locale.
|
||||
* en-GB natively orders day before month, which matches the desired DD/MM/YYYY layout
|
||||
* regardless of the runtime environment (SSR vs client).
|
||||
*/
|
||||
export function formatLocalizedDate(date: string | number | Date) {
|
||||
const d = new Date(date);
|
||||
return new Intl.DateTimeFormat(LOCALE, {
|
||||
return new Intl.DateTimeFormat("en-GB", {
|
||||
day: "2-digit",
|
||||
month: "2-digit",
|
||||
year: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false, // 24-hour format
|
||||
hour12: false,
|
||||
timeZone: TIMEZONE,
|
||||
}).format(d);
|
||||
}
|
||||
@@ -37,13 +38,14 @@ export function formatDateLastContact(lastContact: string | number | Date | null
|
||||
: "Never connected.";
|
||||
}
|
||||
|
||||
export function formatDayOnly(date: Date) {
|
||||
return new Intl.DateTimeFormat(LOCALE, {
|
||||
export function formatDayOnly(date: string | number | Date) {
|
||||
const d = new Date(date);
|
||||
return new Intl.DateTimeFormat("en-GB", {
|
||||
day: "2-digit",
|
||||
month: "2-digit",
|
||||
year: "numeric",
|
||||
timeZone: TIMEZONE,
|
||||
}).format(date);
|
||||
}).format(d);
|
||||
}
|
||||
|
||||
export function getTodayISODate() {
|
||||
|
||||
Reference in New Issue
Block a user