If your date string isn’t automatically recognized by JavaScript, you can manually parse it as a fallback to handle custom date formats :
const dateString = "2012.08.10";
const [year, month, day] = dateString.split('.').map(Number);
const date = new Date(year, month - 1, day); // Month is 0-based
const timestamp = date.getTime() / 1000;
console.log(timestamp); // Unix timestamp (seconds)
If the date format is non-standard or not recognized by JavaScript, manually splitting and parsing the date string ensures compatibility.