LED PWM Dimming

I borrowed a sketch that works fine, though my attempts to modify the sketch were not so successful, I'll
post the sketch I have then explain how I would like it to work

Is there a way to define in the setup the time periods for the lighting so as to simplify editing the value?

I tried to modify how the dim period works to extend it, and whilst I got the period to run for longer it hangs half way through, I guess it’s because it’s with respect to the RTC so as the hour value changes it just stops, though I could easily be dead wrong on that.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "RTClib.h"
#include <VL53L0X.h>

LiquidCrystal_I2C lcd(0x27,20,4); 
VL53L0X sensor;
 // This is the I2C address

// SainSmart LCD 16x2
//LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);

// Arduino Mega 2560
const int Light1 = 2;
const int Light2 = 3;
const unsigned long HOUR = 60 * 60;
const unsigned long MINUTE = 60;
const int TARGET_BRIGHTNESS = (255 * 3) / 4;  // Target brightness is 3/4 of full

void setup()
{  
 //lcd.begin(16, 2);
   
 Wire.begin();
  lcd.init();
  lcd.backlight();

  sensor.init();
  sensor.setTimeout(500);
  sensor.startContinuous();
  
}

byte bcdToDec(byte val)  {
// Convert binary coded decimal to normal decimal numbers
 return ( (val/16*10) + (val%16) );
}

void loop()
{
 lcd.clear(); 
 lcd.setCursor(0,0);
 lcd.print("***");
 lcd.setCursor(4,0);

 /////  Get time from RTC into RTCHour, RTCMinute, RTCSecond

  // Set the register pointer to 0 (Second)
 Wire.beginTransmission(DS1307_ADDRESS);
 Wire.write((byte)0);
 Wire.endTransmission();

 //  Read Second, Minute, and Hour
 Wire.requestFrom(DS1307_ADDRESS, 3);

 int RTCSecond = bcdToDec(Wire.read());
 int RTCMinute = bcdToDec(Wire.read());
 int RTCHour = bcdToDec(Wire.read() & 0b111111); //24 hour time

// write Time to LCD XX:XX:XX
 if(RTCHour < 10) {
   lcd.print("0");
 }
lcd.print(RTCHour);
lcd.print(":");
 if(RTCMinute < 10) {
   lcd.print("0");
 }
lcd.print(RTCMinute);
lcd.print(":");
 if(RTCSecond < 10) {
   lcd.print("0");
 }
lcd.print(RTCSecond);
lcd.setCursor(13,0);
lcd.print("***");
 unsigned long time = RTCHour * HOUR + RTCMinute * MINUTE + RTCSecond;  // Time in seconds
 
// write value within the timeframe to PWM 
 analogWrite(Light1,   brightness(time, 7*HOUR,                 19*HOUR));
 analogWrite(Light2,   brightness(time, 7*HOUR+30*MINUTE,                 19*HOUR+30*MINUTE));

lcd.setCursor(4,1); //Light1
if(((brightness(time, 7*HOUR,                 19*HOUR))*100/255) < 10) {
   lcd.print("0");
 }
lcd.print((brightness(time, 7*HOUR,                 19*HOUR))*100/255);
lcd.print("%");

lcd.setCursor(8,1); //Light2
if(((brightness(time, 7*HOUR+30*MINUTE,                 19*HOUR+30*MINUTE))*100/255) < 10) {
   lcd.print("0");
 }
lcd.print((brightness(time, 7*HOUR+30*MINUTE,                 19*HOUR+30*MINUTE))*100/255);
lcd.print("%");

 delay(1000);
}

byte brightness(unsigned long time, unsigned long fadeUpStart, unsigned long fadeDownStart)
{
 //  Mid day, light is at maximum brightness
 if (time >= fadeUpStart + HOUR  && time <= fadeDownStart)
   return TARGET_BRIGHTNESS;

 // Dawn:  fade up the light
 if (time >= fadeUpStart && time <= fadeUpStart + HOUR)  // Fading up
 {
   unsigned long seconds = time - fadeUpStart;  // Number of seconds into the fade time 
   return TARGET_BRIGHTNESS * seconds / (HOUR);  // Fade up based on portion of interval completed.
 }

 // Evening: Fade down the light
 if (time >= fadeDownStart && time <= fadeDownStart + HOUR)  // Fading down
 {
   unsigned long seconds = (fadeDownStart + (HOUR)) - time;  // Number of seconds remaining in the fade time 
   return TARGET_BRIGHTNESS * seconds / (HOUR);  // Fade down based on portion of interval left.
 }

 // The remaining times are night and the lights is off
 return 0;  // Shouldn't get here
}

Is there a way to define in the setup the time periods for the lighting so as to simplify editing the value?

Probably. It is not clear what "time periods" you are talking about, or what value you need to edit, or how you will do that.