fix rendering org list if org.created is null: (#2243)
- org.created may be null (for backwards compatibility before it was set) - fix frontend type to match backend - update format.date() to accept null, return empty string
This commit is contained in:
parent
cf60c43df2
commit
02c4381694
@ -52,7 +52,7 @@ export type CrawlingDefaults = z.infer<typeof crawlingDefaultsSchema>;
|
||||
export const orgDataSchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
name: z.string(),
|
||||
created: apiDateSchema,
|
||||
created: apiDateSchema.nullable(),
|
||||
slug: z.string(),
|
||||
default: z.boolean(),
|
||||
quotas: orgQuotasSchema,
|
||||
|
@ -201,7 +201,13 @@ export class Localize {
|
||||
};
|
||||
|
||||
// Custom date formatter that takes missing `Z` into account
|
||||
readonly date = (d: Date | string, opts?: Intl.DateTimeFormatOptions) => {
|
||||
readonly date = (
|
||||
d: Date | string | null,
|
||||
opts?: Intl.DateTimeFormatOptions,
|
||||
) => {
|
||||
if (!d) {
|
||||
return "";
|
||||
}
|
||||
const date = new Date(d instanceof Date || d.endsWith("Z") ? d : `${d}Z`);
|
||||
|
||||
const formatter = dateFormatter(
|
||||
|
Loading…
Reference in New Issue
Block a user