From a7021fc8f2de4122e41763005a4f06e3019af026 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 19 Jul 2024 21:10:25 +0200 Subject: [PATCH] Get default date/time format from default settings --- lua/date-time-inserter/init.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/date-time-inserter/init.lua b/lua/date-time-inserter/init.lua index ed98918..4d50801 100644 --- a/lua/date-time-inserter/init.lua +++ b/lua/date-time-inserter/init.lua @@ -20,7 +20,7 @@ local function validate_date_format(date_format) -- Check if the date format has the correct length. if string.len(date_format) ~= 8 then print("INVALID_DATE_FORMAT: Date format must be 8 characters long (e.g. MMDDYYYY).") - return "MMDDYYYY" + return settings.date_format end -- Check wheter the date format contains all the required characters. @@ -32,7 +32,7 @@ local function validate_date_format(date_format) print( "INVALID_DATE_FORMAT: Date format must contain the characters M, D and Y (e.g. MMDDYYYY)." ) - return "MMDDYYYY" + return settings.date_format end -- Check if the date format contains the string 'DD' once. @@ -40,7 +40,7 @@ local function validate_date_format(date_format) print( 'INVALID_DATE_FORMAT: Date format must contain exactly one occurrence of the "DD" string (e.g. MMDDYYYY).' ) - return "MMDDYYYY" + return settings.date_format end -- Check if the date format contains the string 'MM' once. @@ -48,7 +48,7 @@ local function validate_date_format(date_format) print( 'INVALID_DATE_FORMAT: Date format must contain exactly one occurrence of the "MM" string (e.g. MMDDYYYY).' ) - return "MMDDYYYY" + return settings.date_format end -- Check if the date format contains the string 'YYYY' once. @@ -56,7 +56,7 @@ local function validate_date_format(date_format) print( 'INVALID_DATE_FORMAT: Date format must contain exactly one occurrence of the "YYYY" string (e.g. MMDDYYYY).' ) - return "MMDDYYYY" + return settings.date_format end return date_format @@ -68,7 +68,7 @@ end local function validate_time_format(time_format) if time_format ~= 12 and time_format ~= 24 then print("INVALID_TIME_FORMAT: Time format must be either 12 or 24.") - return 12 + return settings.time_format end return time_format