Skip to content

[Bug/Feature Request] Split %date% template into separate Date and Datetime tags #241

Description

@7han0s

The Problem

The current %date% template tag in the Conversion settings generates a full ISO datetime string (e.g., 2026-03-20T09:43:00.000Z).

For users managing daily recurring file the inclusion of timestamps and timezone data results in cluttered filenames that must be manually edited after every download. This limits the effectiveness of the automation provided by the template system.

Proposed Solution (Primary)

Refine the template tags to provide more granular control. This follows standard naming conventions where "date" refers strictly to the calendar day:

  • %datetime%: A new tag that provides the full timestamp (inheriting the current behavior of %date%).
  • %date%: Repurposed to provide only the date portion (e.g., YYYY-MM-DD).

Alternative Solution (Non-breaking)

If avoiding changes to existing user configurations is a priority, keep the current %date% behavior as-is and introduce a new specific tag:

  • %shortdate% or %d%: A new tag providing only the date portion (e.g., YYYY-MM-DD).

Technical Implementation Details

1. Logic Update

In src/lib/types/file.svelte.ts, the download() method currently handles these replacements. The formatting logic can be updated to support both variations:

// Proposed update to formatting logic in src/lib/types/file.svelte.ts
const format = (name: string) => {
    const now = new Date();
    const fullIso = now.toISOString();
    const dateOnly = fullIso.split('T')[0]; // Result: YYYY-MM-DD
    
    const baseName = this.file.name.replace(/\.[^/.]+$/, "");
    const originalExtension = this.file.name.split(".").pop()!;
    
    return name
        .replace(/%datetime%/g, fullIso)
        .replace(/%date%/g, dateOnly) // Or %shortdate% for the alternative
        .replace(/%name%/g, baseName)
        .replace(/%extension%/g, originalExtension);
};

2. Documentation & Typo Fix

The description for the filename format contains a minor grammatical error.

  • File: messages/en.json
  • Key: settings.conversion.filename_description
  • Current: "...You can put these following templates..."
  • Correction: "...You can put the following templates..."

The description should also be updated to list the new tag (either %datetime% or %shortdate%) so users are aware of the option.

Benefits

  • Automation: Allows users to set a format once for daily files without manual intervention.
  • Clarity: Aligns tag names with the actual data they produce, making the settings more intuitive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions