If you had a book which had on its Contents page:
Chapter 1 . . . . . . . . . . page 1
and you crossed it out, then wrote:
Chapter 1 . . . . . . . . . . page 1
Chapter 2 . . . . . . . . . . page 50
someone looking for Chapter 1 is still going to find all the text in the right place (as long as it was less than 50 pages).
Changing the partitition table is like changing the Contents page; it doesn't mess with the rest of the data. And if the new table points to the same place it did before, the data can still be found.
That said, if the filesystem still thinks it's 1TB, you may end up with future problems unless you resize it to fit the reduced partition.
You've replied while I was editing, so see that regarding what I mean by side effects.
As far as throwing an error when you try to create "31st February", this wouldn't actually help much, since the error would still only occur on some days of the year, because your original code doesn't account for the range of outputs from
Date()
when called without arguments.To perform correctly, your code needs to normalise the day of the month, or just create the date more explicitly to begin with, but this is a calendrical issue, not a JavaScript one.