obsidianmd / obsidian-clipper

Official web clipper extension for Obsidian.
https://obsidian.md/clipper
MIT License
986 stars 44 forks source link

BUG: Formatters for date variables in file name gives null #164

Closed ndrezn closed 4 hours ago

ndrezn commented 5 hours ago

Version (please complete the following information):

Describe the bug Using date variables functions correctly:

Screenshot 2024-11-14 at 3 51 55 PM

And results in:

Screenshot 2024-11-14 at 3 52 26 PM

But, using a format as described in https://publish.obsidian.md/shellcommands/Variables/%7B%7Bdate%7D%7D fails:

Screenshot 2024-11-14 at 3 53 01 PM

Gives:

Screenshot 2024-11-14 at 3 53 13 PM

Expected behavior

Expected formatters to work.

URLs where the bug occurs

Universal.

To reproduce

Steps to reproduce the behavior:

  1. Go to Clippings "Settings"
  2. Pick a template
  3. Edit template "Note location" to Clippings/{{date}}
  4. Attempt to clip a site

Your template file

If you are using a custom template (i.e. not the Default template). Go to Web Clipper settings and click MoreCopy as JSON. Paste the JSON code below.

{
  "schemaVersion": "0.1.0",
  "name": "Default",
  "behavior": "create",
  "noteContentFormat": "{{content}}",
  "properties": [
    {
      "name": "title",
      "value": "{{title}}",
      "type": "text"
    },
    {
      "name": "source",
      "value": "{{url}}",
      "type": "text"
    },
    {
      "name": "author",
      "value": "{{author|split:\\\", \\\"|wikilink|join}}",
      "type": "multitext"
    },
    {
      "name": "published",
      "value": "{{published}}",
      "type": "date"
    },
    {
      "name": "created",
      "value": "{{date}}",
      "type": "date"
    },
    {
      "name": "description",
      "value": "{{description}}",
      "type": "text"
    },
    {
      "name": "tags",
      "value": "clippings",
      "type": "multitext"
    }
  ],
  "triggers": [],
  "noteNameFormat": "{{title}}",
  "path": "Clippings/{{date:YYYY}}"
}
kepano commented 4 hours ago

{{date:YYYY}} is not a valid variable. Please review the documentation.

You're looking for {{date|date:"YYYY"}}