refactor: move some date things about and separate, remove unnecessary files

This commit is contained in:
David Ralph
2024-09-20 23:30:07 +01:00
parent 9393c20ea8
commit 728ef587e1
9 changed files with 45 additions and 61 deletions

View File

@@ -1,7 +1,7 @@
import variables from 'config/variables';
import { useRef, useState, useEffect } from 'react';
import { nth, convertTimezone } from 'utils/date';
import { appendNth, convertTimezone } from 'utils/date';
import EventBus from 'utils/eventbus';
import defaults from './options/default';
@@ -107,7 +107,7 @@ function Greeting() {
if (birth.getDate() === now.getDate() && birth.getMonth() === now.getMonth()) {
if (localStorage.getItem('birthdayage') === 'true' && calculateAge(birth) !== 0) {
const text = variables.getMessage('widgets.greeting.birthday').split(' ');
message = `${text[0]} ${nth(calculateAge(birth))} ${text[1]}`;
message = `${text[0]} ${appendNth(calculateAge(birth))} ${text[1]}`;
} else {
message = variables.getMessage('widgets.greeting.birthday');
}

View File

@@ -1,7 +1,7 @@
import variables from 'config/variables';
import { useState, useEffect, useRef, useCallback } from 'react';
import { nth, convertTimezone } from 'utils/date';
import { appendNth, convertTimezone } from 'utils/date';
import EventBus from 'utils/eventbus';
import defaults from './options/default';
@@ -98,7 +98,7 @@ const DateWidget = () => {
const datenth =
localStorage.getItem('datenth') === 'true'
? nth(currentDate.getDate())
? appendNth(currentDate.getDate())
: currentDate.getDate();
const dateDay =