declare time before usage

This commit is contained in:
2023-04-27 14:42:21 +10:00
parent 17beb4152b
commit 0de8e17593

View File

@@ -74,6 +74,7 @@ export class SMDate {
{ format = "dmy", utc = false } = {}
): SMDate {
const now = new Date();
let time = "";
if (dateString.toLowerCase() === "now") {
this.date = now;
@@ -96,7 +97,6 @@ export class SMDate {
// Split the date string into an array of components based on the length of each date component
const components = dateString.split(/[ /-]/);
let time = "";
for (const component of components) {
if (isNaN(parseInt(component))) {
return this;