forked from athenekilta/ilmomasiina
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove moment.js from frontend (fix #91)
- Loading branch information
1 parent
443c6c8
commit 271b41c
Showing
25 changed files
with
239 additions
and
186 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
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
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
5 changes: 1 addition & 4 deletions
5
packages/ilmomasiina-components/src/routes/SingleEvent/components/SignupCountdown.tsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { useTranslation } from "react-i18next"; | ||
|
||
import { timezone } from "../config"; | ||
|
||
/** Returns a formatter for event dates like "31.12.2024". */ | ||
export function useEventDateFormatter() { | ||
const { t } = useTranslation(); | ||
const locale = t("dateFormat.locale"); | ||
return new Intl.DateTimeFormat(locale, { | ||
day: "numeric", | ||
month: "numeric", | ||
year: "numeric", | ||
hour12: false, | ||
timeZone: timezone(), | ||
}); | ||
} | ||
|
||
/** Returns a formatter for event datetimes like "su 31.12.2024 23:59". */ | ||
export function useEventDateTimeFormatter() { | ||
const { t } = useTranslation(); | ||
const locale = t("dateFormat.locale"); | ||
return new Intl.DateTimeFormat(locale, { | ||
weekday: "short", | ||
day: "numeric", | ||
month: "numeric", | ||
year: "numeric", | ||
hour: "numeric", | ||
minute: "numeric", | ||
hour12: false, | ||
timeZone: timezone(), | ||
}); | ||
} | ||
|
||
/** Returns a formatter for seconds-accurate datetimes like "31.12.2024 23:59:59". */ | ||
export function useActionDateTimeFormatter() { | ||
const { t } = useTranslation(); | ||
const locale = t("dateFormat.locale"); | ||
return new Intl.DateTimeFormat(locale, { | ||
day: "numeric", | ||
month: "numeric", | ||
year: "numeric", | ||
hour: "numeric", | ||
minute: "numeric", | ||
second: "numeric", | ||
hour12: false, | ||
timeZone: timezone(), | ||
}); | ||
} | ||
|
||
/** Returns a formatter for the milliseconds of a time. */ | ||
export function useMillisecondsDateTimeFormatter() { | ||
const { t } = useTranslation(); | ||
const locale = t("dateFormat.locale"); | ||
return new Intl.DateTimeFormat(locale, { | ||
fractionalSecondDigits: 3, | ||
}); | ||
} | ||
|
||
/** Returns a formatter for seconds-accurate datetimes like "31.12.2024 23:59:59". */ | ||
export function getCsvDateTimeFormatter() { | ||
return new Intl.DateTimeFormat("fi-FI", { | ||
day: "numeric", | ||
month: "numeric", | ||
year: "numeric", | ||
hour: "numeric", | ||
minute: "numeric", | ||
second: "numeric", | ||
hour12: false, | ||
timeZone: timezone(), | ||
}); | ||
} |
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
Oops, something went wrong.