-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
186 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 9 additions & 6 deletions
15
packages/api/router/orgHours/query.forHoursDisplay.schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { z } from 'zod' | ||
|
||
import { prefixedId } from '~api/schemas/idPrefix' | ||
import { isIdFor } from '@weareinreach/db' | ||
|
||
export const ZForHoursDisplaySchema = z.union([ | ||
prefixedId('organization'), | ||
prefixedId('orgService'), | ||
prefixedId('orgLocation'), | ||
]) | ||
export const ZForHoursDisplaySchema = z.string() | ||
// .refine((val) => isIdFor('organization', val) || isIdFor('orgLocation', val) || isIdFor('orgService', val)) | ||
|
||
// z.union([ | ||
// prefixedId('organization'), | ||
// prefixedId('orgService'), | ||
// prefixedId('orgLocation'), | ||
// ]) | ||
export type TForHoursDisplaySchema = z.infer<typeof ZForHoursDisplaySchema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { useRouter } from 'next/router' | ||
|
||
const proper = (s: string) => s.charAt(0).toLocaleUpperCase() + s.slice(1) | ||
|
||
export const useLocalizedDays = (locale?: string) => { | ||
const routerLocale = useRouter().locale | ||
locale ??= routerLocale | ||
const { format: dayFormat } = new Intl.DateTimeFormat(locale, { weekday: 'short' }) | ||
const dayMap = new Map( | ||
[...Array(7).keys()].map((day, i) => [i, proper(dayFormat(new Date(Date.UTC(2021, 5, day))))]) | ||
) | ||
return dayMap | ||
} |
Oops, something went wrong.