Fixing day extension and date string.
This commit is contained in:
parent
273cdaab06
commit
b5bed59e2d
1 changed files with 5 additions and 5 deletions
|
@ -70,11 +70,11 @@ export const getGreeting = (greetings: Array<IGreetingProps>): string => {
|
||||||
export const getExtension = (day: number) => {
|
export const getExtension = (day: number) => {
|
||||||
let extension = "th";
|
let extension = "th";
|
||||||
|
|
||||||
if (day % 10 === 1) {
|
if (day % 10 === 1 && day !== 11) {
|
||||||
extension = "st";
|
extension = "st";
|
||||||
} else if (day % 10 === 2) {
|
} else if (day % 10 === 2 && day !== 12) {
|
||||||
extension = "nd";
|
extension = "nd";
|
||||||
} else if (day % 10 === 3) {
|
} else if (day % 10 === 3 && day !== 13) {
|
||||||
extension = "rd";
|
extension = "rd";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,9 +93,9 @@ export const getDateString = (
|
||||||
) => {
|
) => {
|
||||||
let currentDate = new Date();
|
let currentDate = new Date();
|
||||||
|
|
||||||
let weekday = weekdays[currentDate.getUTCDay()];
|
let weekday = weekdays[currentDate.getDay()];
|
||||||
let day = currentDate.getDate();
|
let day = currentDate.getDate();
|
||||||
let month = months[currentDate.getUTCMonth()];
|
let month = months[currentDate.getMonth()];
|
||||||
let extension = getExtension(day);
|
let extension = getExtension(day);
|
||||||
let year = currentDate.getFullYear();
|
let year = currentDate.getFullYear();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue