mirror of
https://github.com/spliit-app/spliit.git
synced 2026-02-21 15:06:13 +01:00
Create expense from receipt (#69)
* Create expense from receipt * Add modal * Update README
This commit is contained in:
committed by
GitHub
parent
9e300e0ff0
commit
4a9bf575bd
@@ -17,6 +17,8 @@ const envSchema = z
|
||||
S3_UPLOAD_SECRET: z.string().optional(),
|
||||
S3_UPLOAD_BUCKET: z.string().optional(),
|
||||
S3_UPLOAD_REGION: z.string().optional(),
|
||||
NEXT_PUBLIC_ENABLE_RECEIPT_EXTRACT: z.coerce.boolean().default(false),
|
||||
OPENAI_API_KEY: z.string().optional(),
|
||||
})
|
||||
.superRefine((env, ctx) => {
|
||||
if (
|
||||
@@ -32,6 +34,13 @@ const envSchema = z
|
||||
'If NEXT_PUBLIC_ENABLE_EXPENSE_DOCUMENTS is specified, then S3_* must be specified too',
|
||||
})
|
||||
}
|
||||
if (env.NEXT_PUBLIC_ENABLE_RECEIPT_EXTRACT && !env.OPENAI_API_KEY) {
|
||||
ctx.addIssue({
|
||||
code: ZodIssueCode.custom,
|
||||
message:
|
||||
'If NEXT_PUBLIC_ENABLE_RECEIPT_EXTRACT is specified, then OPENAI_API_KEY must be specified too',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
export const env = envSchema.parse(process.env)
|
||||
|
||||
@@ -8,3 +8,10 @@ export function cn(...inputs: ClassValue[]) {
|
||||
export function delay(ms: number) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
export function formatExpenseDate(date: Date) {
|
||||
return date.toLocaleDateString('en-US', {
|
||||
dateStyle: 'medium',
|
||||
timeZone: 'UTC',
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user