Files
mue/src/modules/helpers/date.js
alexsparkes 7bb48ebc8e fix: author loading before quote
- Make author div not load if quote is empty
- photoinformation taking too much of the screen
- more transitions and consistent transitions
- running prettier across all files

Co-authored-by: David Ralph <me@davidcralph.co.uk>
2022-04-11 22:57:07 +01:00

25 lines
423 B
JavaScript

export function nth(d) {
if (d > 3 && d < 21) {
return d + 'th';
}
switch (d % 10) {
case 1:
return d + 'st';
case 2:
return d + 'nd';
case 3:
return d + 'rd';
default:
return d + 'th';
}
}
export function convertTimezone(date, tz) {
return new Date(
(typeof date === 'string' ? new Date(date) : date).toLocaleString('en-US', {
timeZone: tz,
}),
);
}