I think I’m going crazy.
I have processed the data in the following form
const csvData = `
Timestamp,user,folder,Data
12.07.2024 12:56:21.847,B6,DC,eeebbb
12.07.2024 12:56:27.257,B9,DA,aaaggg
`;
I would like to split the Timestamp and keep the part of the Date which will be written in a Table. unfortunately I have already tried everything and I only receive part of the hour.
this is how the data processing procedure begins
function parseCSV(data) {
const lines = data.trim().split('n');
const headers = lines[0].split(',');
const rows = lines.slice(1).map(line => {
const columns = line.match(/(".*?"|[^",s]+)(?=s*,|s*$)/g);
return headers.reduce((obj, header, index) => {
obj[header.trim()] = columns[index].replace(/^"|"$/g, '');
return obj;
}, {});
});
return rows;
}
function extractWords(data) {
return data.map(row => {
const folderKey = row['folder'];
const folder = objectMapping[folderKey] || folderKey;
// Extract only the date from the timestamp
const timestamp = row['Timestamp'].split(' ')[0];
const searchString = row['Searchdata'];
const matches = searchString.match(/'([^']*)'/g) || [];
const words = matches.map(match => match.replace(/'/g, ''));
return { ordner, timestamp, words };
});
}
Anyone have a suggestion?
4