Skip to content

Commit

Permalink
add extra daily notes formats
Browse files Browse the repository at this point in the history
  • Loading branch information
laughedelic committed Nov 12, 2024
1 parent 3c2f8a3 commit a05a4b2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions outbreak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface ObsidianAppConfig {

interface MigrationConfig {
useNamespaces: boolean;
extraDailyNotesFormats: string[];
journalDateFormat: string;
ignoredPaths: string[];
dryRun: boolean;
Expand Down Expand Up @@ -116,7 +117,10 @@ function planFileMigration(
const outputFormat = config.journalDateFormat;

// Reformat the date string according to the configured format
const parsedDate = moment(inputFilename, inputFormat);
const parsedDate = moment(inputFilename, [
inputFormat,
...config.extraDailyNotesFormats,
]);
const reformattedDate = parsedDate.isValid()
? parsedDate.format(outputFormat)
: inputFilename;
Expand Down Expand Up @@ -269,10 +273,15 @@ async function executeMigrationPlan(

const defaultConfig: MigrationConfig = {
useNamespaces: false,
extraDailyNotesFormats: [
"YYYY/YYYY-MM-DD",
"YYYY/MM/YYYY-MM-DD",
],
journalDateFormat: "YYYY-MM-DD",
ignoredPaths: [
"archive/**",
// "archive/**",
"**/*.txt",
"**/*.json",
".*/**", // any hidden directories in the root
"**/.*", // hidden files (anywhere)
],
Expand Down

0 comments on commit a05a4b2

Please sign in to comment.