Per
https://www.tsuki.world/world/the-moon-is-beautiful-isnt-it
"月が綺麗ですね | tsuki ga kirei desu ne translates to “The moon is beautiful, isn’t it?” This phrase is a more poetic way of saying I love you. During Japanese writer Natsume Sōseki’s (1867-1916) teaching years, he supposedly overheard a student translating “I love you” rather awkwardly into its literal and direct translation: “Ware Kimi wo Aisu.” Soseki believed—as a product of his time and culture in the Meiji period—that this direct translation rejected Japanese sensibility. Thus, this more subtle, nuanced translation of “the moon is beautiful…” was born."
Whether that story is true or not, it's been accepted into the culture for decades now which is why you see it in so many animes and other things. There's even an anime with that phrase as the title. But basically, the idea is that if you were walking with the person you liked at night, you could say "the moon is beautiful" and in that already romantic situation, it would be an indirect declaration of love.
"Tsuki ga kirei desu ne"
Is another way to say " I love You"