DS3231 resets when power-off with Arduino Pro Mini

RTC DS3231 is working well with Arduino Nano but with the same code on Arduino Pro Mini, 16 MHz, 5V, everytime it is powered off the clock reset itself back to 1/1/2000. Or in fact it reset the time when power is connected back on. If I move the clock to Nano after it's powered off in Pro mini it is still running the proper time.

It doesn't resets when using with Nano.

Backup battery is alive and well, no problem with it, it's voltage is 3.3, type CR 2032.

Used Rtclib is RTClib by Adafruit, version 1.3.3

Don't know how fix this. Any advice in this matter is taken with great gratitude.

Please read How to use this forum, and post the code, using code tags.

Code to setup the clock

// Date and time functions using a DS3231 RTC connected via I2C and Wire lib
// Credits for rtclib to : Code by JeeLabs http://news.jeelabs.org/code/  Released to the public domain! Enjoy!

// Converted so that RTC uses UTC time instead of the local time
// Scion Riverson 2018

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

RTC_DS3231 rtc;   // create RTC object

// timezone offsets in seconds for West European Time / West European Summer Time WET/WEST
// change these to your own timezone
// more information available in linux with command: zdump -v timezone
// for example : zdump -v Atlantic/Canary
// Check functions is_Dls_On() (Is Daylight Saving On), getUtcTime() and getLocalTime() later on this code

// these timezone settings must be set correctly for your timezone when you want to setup RTC time to UTC automatically from computer
// 1 hour = 3600 seconds

unsigned long     dls_On_Offset = 3600;   // Summer time offset in seconds to UTC time when Day light saving is On
unsigned long     dls_Off_Offset = 0;     // Winter time offset in seconds to UTC time when Day light saving is Off
unsigned long     compile_delay = 9;      // delay in seconds from compiling the sketch to the setting of time to the RTC

char strDate[11];           //date string
char strTime[9];            //time string

void setup() {
  Serial.begin(9600);       // open serial connection
  delay(500);               // wait for console opening

  if (! rtc.begin()) {      // rtc.begin() - initialize clock routines for use
    Serial.println("Couldn't find RTC");
    while (1);              // stop here
  }

  // ******************************

  // uncomment this section if you want to set UTC time to RTC automatically
  // Notice that you should run it only once!

  // following line sets the RTC to the date & time of the compilation of this sketch
  // After this phase the time in RTC is local time from computer

  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

  // !!!!!! FOLLOWING SETTING PROCEDURE FOR UTC TIME MAY NOT WORK PROPERLY IF YOUR LOCAL TIME
  // !!!!!! IS NEAR DAYLIGHT SAVING CHANGING MOMENT AND WITHIN THE UTC OFFSETS
  // figuring out when exactly is still unfinished because I ran out of fingers when thinking it

  // In this phase we use the local time for checking if the day light saving is on or off
  // is_Dls_On() expects UTC time to work properly, but local time is good enough if it is not within few hours from the changing time

  if (is_Dls_On(rtc.now().unixtime())) {
    rtc.adjust((rtc.now() - TimeSpan(dls_On_Offset - compile_delay))); // Set UTC time from local summer time + fix compile delay
  }
  else {
    rtc.adjust((rtc.now() - TimeSpan(dls_Off_Offset - compile_delay))); // Set UTC time from local winter time + fix compile delay
  }
  Serial.println("RTC module is set to UTC time");
  printTimes();
  Serial.println("Load something else to the microcontroller. Otherwise this program will set RTC back to compile time when rebooted.");

  //while (1); // stop here.

  // comment this section out when time is set and compile this code and load it again. If you don't do that the RTC time will fail because
  // microcontroller will load compile time back to RTC clock if this program is started when rebooting

  // ******************************

  Serial.println();
  Serial.println("Enter ? to get current date and time");

}

void loop() {

  // get rid of that irritating delay()/printing loop, just show date/times when asked
  if (Serial.available()) {
    char input = Serial.read();
    switch (input) {      // room for extended input options, propably should change this back to if sentence
      case '?':           // got question mark, printout date and times
        printTimes();
        Serial.println("Enter ? to get current date and time");
        break;
    }
  }
}

boolean is_Dls_On(unsigned long ut) {
  // ut = unix timestamp for current UTC time

  // Unix timestamps in the following list are UTC timestamps for daylight saving changing moments for the timezone.
  // They are intentionally one second before the full hour when the change happens
  // This list is for the Canary Islands (WET/WEST timezone). For other timezones new timestamps needs to be calculated.
  // In linux you can get these changing dates and times for a timezone with command : zdump -v timezone
  // You still need to convert the dates and times to unix timestamps but there are programs and web sites to do that.
  // Note. This list seems to be valid for whole Europe 

  // check if daylight saving is on
  if (ut > 1521939599 && ut < 1540688399  ||      //25.03.18 00:59:59  28.10.18 00:59:59
      ut > 1553993999 && ut < 1572137999  ||      //31.03.19 00:59:59  27.10.19 00:59:59
      ut > 1585443599 && ut < 1603587599  ||      //29.03.20 00:59:59  25.10.20 00:59:59
      ut > 1616893199 && ut < 1635641999  ||      //28.03.21 00:59:59  31.10.21 00:59:59
      ut > 1648342799 && ut < 1667091599          //27.03.22 00:59:59  30.10.22 00:59:59
      //      ut > 1648342799 && ut < 1667091599  ||      //27.03.22 00:59:59  30.10.22 00:59:59
      //      ut > 1679792399 && ut < 1698541199  ||      //26.03.23 00:59:59  29.10.23 00:59:59
      //      ut > 1711846799 && ut < 1729990799  ||      //31.03.24 00:59:59  27.10.24 00:59:59
      //      ut > 1743296399 && ut < 1761440399  ||      //30.03.25 00:59:59  26.10.25 00:59:59
      //      ut > 1774745999 && ut < 1792889999          //29.03.26 00:59:59  25.10.26 00:59:59
     )
  {
    return (true);
  }
  else {
    return (false);
  }
}

DateTime getUtcTime() {
  // expects that RTC time is set to UTC
  return (rtc.now());
}

DateTime getLocalTime() {
  // expects that RTC time is set to UTC
  if (is_Dls_On(rtc.now().unixtime())) {
    return (rtc.now() + TimeSpan(dls_On_Offset)); // return local summertime
  }
  else {
    return (rtc.now() + TimeSpan(dls_Off_Offset)); // return local winter time
  }
}

void getTimeStr(DateTime dt) {
  // strDate and strTime are global variables
  sprintf(strDate, "%02d.%02d.%04d", dt.day(), dt.month(), dt.year());
  sprintf(strTime, "%02d:%02d:%02d", dt.hour(), dt.minute(), dt.second());
}

void printTimes() {
  // puke all essential date/time data to serial
  getTimeStr(getUtcTime());     // read UTC time
  Serial.println("UTC");
  Serial.print(strDate);
  Serial.print(" ");
  Serial.println(strTime);

  getTimeStr(getLocalTime());   // read local time
  Serial.println("Local");
  Serial.print(strDate);
  Serial.print(" ");
  Serial.println(strTime);

  Serial.print("Normal time's offset to UTC in seconds ");
  Serial.println(dls_Off_Offset, DEC);

  Serial.print("Daylight saving time's offset to UTC in seconds ");
  Serial.println(dls_On_Offset, DEC);

  if (is_Dls_On(rtc.now().unixtime())) {
    Serial.println("Daylight saving is ON");
  }
  else {
    Serial.println("Daylight saving is OFF");
  }
}

Code to test the clock. Loaded right after setup.

// Date and time functions using a DS3231 RTC connected via I2C and Wire lib
// Credits for rtclib to : Code by JeeLabs http://news.jeelabs.org/code/  Released to the public domain! Enjoy!

// Converted so that RTC uses UTC time instead of the local time
// Scion Riverson 2018

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

RTC_DS3231 rtc;   // create RTC object

// timezone offsets in seconds for West European Time / West European Summer Time WET/WEST
// change these to your own timezone
// more information available in linux with command: zdump -v timezone
// for example : zdump -v Atlantic/Canary
// Check functions is_Dls_On() (Is Daylight Saving On), getUtcTime() and getLocalTime() later on this code

// these timezone settings must be set correctly for your timezone when you want to setup RTC time to UTC automatically from computer
// 1 hour = 3600 seconds

unsigned long     dls_On_Offset = 3600;   // Summer time offset in seconds to UTC time when Day light saving is On
unsigned long     dls_Off_Offset = 0;     // Winter time offset in seconds to UTC time when Day light saving is Off
unsigned long     compile_delay = 9;      // delay in seconds from compiling the sketch to the setting of time to the RTC

char strDate[11];           //date string
char strTime[9];            //time string

void setup() {
  Serial.begin(9600);       // open serial connection
  delay(500);               // wait for console opening

  if (! rtc.begin()) {      // rtc.begin() - initialize clock routines for use
    Serial.println("Couldn't find RTC");
    while (1);              // stop here
  }

  // ******************************

  // uncomment this section if you want to set UTC time to RTC automatically
  // Notice that you should run it only once!

  // following line sets the RTC to the date & time of the compilation of this sketch
  // After this phase the time in RTC is local time from computer
//
//  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
//
//  // !!!!!! FOLLOWING SETTING PROCEDURE FOR UTC TIME MAY NOT WORK PROPERLY IF YOUR LOCAL TIME
//  // !!!!!! IS NEAR DAYLIGHT SAVING CHANGING MOMENT AND WITHIN THE UTC OFFSETS
//  // figuring out when exactly is still unfinished because I ran out of fingers when thinking it
//
//  // In this phase we use the local time for checking if the day light saving is on or off
//  // is_Dls_On() expects UTC time to work properly, but local time is good enough if it is not within few hours from the changing time
//
//  if (is_Dls_On(rtc.now().unixtime())) {
//    rtc.adjust((rtc.now() - TimeSpan(dls_On_Offset - compile_delay))); // Set UTC time from local summer time + fix compile delay
//  }
//  else {
//    rtc.adjust((rtc.now() - TimeSpan(dls_Off_Offset - compile_delay))); // Set UTC time from local winter time + fix compile delay
//  }
//  Serial.println("RTC module is set to UTC time");
//  printTimes();
//  Serial.println("Load something else to the microcontroller. Otherwise this program will set RTC back to compile time when rebooted.");

  //while (1); // stop here.

  // comment this section out when time is set and compile this code and load it again. If you don't do that the RTC time will fail because
  // microcontroller will load compile time back to RTC clock if this program is started when rebooting

  // ******************************

  Serial.println();
  Serial.println("Enter ? to get current date and time");

}

void loop() {

  // get rid of that irritating delay()/printing loop, just show date/times when asked
  if (Serial.available()) {
    char input = Serial.read();
    switch (input) {      // room for extended input options, propably should change this back to if sentence
      case '?':           // got question mark, printout date and times
        printTimes();
        Serial.println("Enter ? to get current date and time");
        break;
    }
  }
}

boolean is_Dls_On(unsigned long ut) {
  // ut = unix timestamp for current UTC time

  // Unix timestamps in the following list are UTC timestamps for daylight saving changing moments for the timezone.
  // They are intentionally one second before the full hour when the change happens
  // This list is for the Canary Islands (WET/WEST timezone). For other timezones new timestamps needs to be calculated.
  // In linux you can get these changing dates and times for a timezone with command : zdump -v timezone
  // You still need to convert the dates and times to unix timestamps but there are programs and web sites to do that.
  // Note. This list seems to be valid for whole Europe 

  // check if daylight saving is on
  if (ut > 1521939599 && ut < 1540688399  ||      //25.03.18 00:59:59  28.10.18 00:59:59
      ut > 1553993999 && ut < 1572137999  ||      //31.03.19 00:59:59  27.10.19 00:59:59
      ut > 1585443599 && ut < 1603587599  ||      //29.03.20 00:59:59  25.10.20 00:59:59
      ut > 1616893199 && ut < 1635641999  ||      //28.03.21 00:59:59  31.10.21 00:59:59
      ut > 1648342799 && ut < 1667091599          //27.03.22 00:59:59  30.10.22 00:59:59
     )
  {
    return (true);
  }
  else {
    return (false);
  }
}

DateTime getUtcTime() {
  // expects that RTC time is set to UTC
  return (rtc.now());
}

DateTime getLocalTime() {
  // expects that RTC time is set to UTC
  if (is_Dls_On(rtc.now().unixtime())) {
    return (rtc.now() + TimeSpan(dls_On_Offset)); // return local summertime
  }
  else {
    return (rtc.now() + TimeSpan(dls_Off_Offset)); // return local winter time
  }
}

void getTimeStr(DateTime dt) {
  // strDate and strTime are global variables
  sprintf(strDate, "%02d.%02d.%04d", dt.day(), dt.month(), dt.year());
  sprintf(strTime, "%02d:%02d:%02d", dt.hour(), dt.minute(), dt.second());
}

void printTimes() {
  // puke all essential date/time data to serial
  getTimeStr(getUtcTime());     // read UTC time
  Serial.println("UTC");
  Serial.print(strDate);
  Serial.print(" ");
  Serial.println(strTime);

  getTimeStr(getLocalTime());   // read local time
  Serial.println("Local");
  Serial.print(strDate);
  Serial.print(" ");
  Serial.println(strTime);

  Serial.print("Normal time's offset to UTC in seconds ");
  Serial.println(dls_Off_Offset, DEC);

  Serial.print("Daylight saving time's offset to UTC in seconds ");
  Serial.println(dls_On_Offset, DEC);

  if (is_Dls_On(rtc.now().unixtime())) {
    Serial.println("Daylight saving is ON");
  }
  else {
    Serial.println("Daylight saving is OFF");
  }
}

Where's the rest of the required information? (as in: everything we would need to be able to exactly reproduce your project)