Skip to content

Commit 02c4381

Browse files
authored
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
1 parent cf60c43 commit 02c4381

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

frontend/src/types/org.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export type CrawlingDefaults = z.infer<typeof crawlingDefaultsSchema>;
5252
export const orgDataSchema = z.object({
5353
id: z.string().uuid(),
5454
name: z.string(),
55-
created: apiDateSchema,
55+
created: apiDateSchema.nullable(),
5656
slug: z.string(),
5757
default: z.boolean(),
5858
quotas: orgQuotasSchema,

frontend/src/utils/localize.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,13 @@ export class Localize {
201201
};
202202

203203
// Custom date formatter that takes missing `Z` into account
204-
readonly date = (d: Date | string, opts?: Intl.DateTimeFormatOptions) => {
204+
readonly date = (
205+
d: Date | string | null,
206+
opts?: Intl.DateTimeFormatOptions,
207+
) => {
208+
if (!d) {
209+
return "";
210+
}
205211
const date = new Date(d instanceof Date || d.endsWith("Z") ? d : `${d}Z`);
206212

207213
const formatter = dateFormatter(

0 commit comments

Comments
 (0)