decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.65k stars 3.02k forks source link

Markdown file dates not saving in UTC format #7171

Open msm1227 opened 2 months ago

msm1227 commented 2 months ago

Describe the bug I am getting some weird behavior on my 11ty site. I have a group of authors that publish posts and their posts are coming across with "Invalid DateTime".

An example of a bad date in the md file: date: 2024-04-08T14:31

And then a good one: date: 2024-04-08T14:25:00.186Z

Applicable Versions: Below is what my admin.html page references for decap version:

CMS configuration

backend:

    # Use netlify identity as backend
    name: git-gateway
    branch: master
  media_folder: "src/static/img"
  public_folder: "/static/img"
  logo_url: https://thecompany.com/static/img/thecompany.png

  local_backend: true
  #publish_mode: editorial_workflow
  collections:
    - label: "NFL Blog"
      name: "NFL Blog"
      folder: "src/NFL/posts"
      create: true
      slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
      sort: 'date:desc'
      editor:
        preview: false
      fields:
        - { label: "Title", name: "title", widget: "string" }
        - {
          label: 'Author',
          name: 'author',
          widget: 'select',
          multiple: true,
          options: ["William Johnson","Nate Willaims","Tyler Smith","Derrick Others","Ryan White","Miles Jones","Bryan \"The Goon\" Boykin"],
          }
       - { label: "Publish Date", name: "date",   widget: "datetime", default: "",date_format: "YYYY-MM-DD",time_format: "HH:mm",format: "LLL", picker_utc: true}
        - {
          label: 'Blog Categories',
          name: 'categories',
          widget: 'select',
          multiple: true,
          options: ["Category A","Fantasy Football","Player Updates","Injury Round Up","Injury Snapshots","NFL Draft"],
          }
        - { label: "Blog Tags", name: "tags", widget: "list" }
        - { label: "Cover Image", name: "coverImage", widget: "image" }
        - { label: "Cover Image Alt Text", name: "coverImageAlt", widget: "string" }
        - { label: "Body", name: "body", widget: "markdown" }
      sortable_fields: ['date', 'title', 'author']
    - label: "Latest Injuries"
      name: "Latest Injuries"
      folder: "src/injuries/posts"
      create: true
      slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
      sort: 'date:desc'
      editor:
        preview: false
      fields:
        - { label: "Title", name: "title", widget: "string" }
        - { label: "Injury Date", name: "date",   widget: "datetime", default: "",date_format: "YYYY-MM-DD",time_format: "HH:mm",format: "LLL", picker_utc: true}
        - { label: "Player", name: "player", widget: "string" }
        - {
          label: 'Team',
          name: 'team',
          widget: 'select',
          multiple: false,
          options: [
            "Arizona Cardinals", "Atlanta Falcons", "Baltimore Ravens", "Buffalo Bills",
            "Carolina Panthers", "Chicago Bears", "Cincinnati Bengals", "Cleveland Browns",
            "Dallas Cowboys", "Denver Broncos", "Detroit Lions", "Green Bay Packers",
            "Houston Texans", "Indianapolis Colts", "Jacksonville Jaguars", "Kansas City Chiefs",
            "Las Vegas Raiders", "Los Angeles Chargers", "Los Angeles Rams", "Miami Dolphins",
            "Minnesota Vikings", "New England Patriots", "New Orleans Saints", "New York Giants",
            "New York Jets", "Philadelphia Eagles", "Pittsburgh Steelers", "San Francisco 49ers",
            "Seattle Seahawks", "Tampa Bay Buccaneers", "Tennessee Titans", "Washington Commanders",
            "Atlanta Hawks", "Boston Celtics", "Brooklyn Nets", "Charlotte Hornets",
            "Chicago Bulls", "Cleveland Cavaliers", "Dallas Mavericks", "Denver Nuggets",
            "Detroit Pistons", "Golden State Warriors", "Houston Rockets", "Indiana Pacers",
            "LA Clippers", "Los Angeles Lakers", "Memphis Grizzlies", "Miami Heat",
            "Milwaukee Bucks", "Minnesota Timberwolves", "New Orleans Pelicans",
            "New York Knicks", "Oklahoma City Thunder", "Orlando Magic", "Philadelphia 76ers",
            "Phoenix Suns", "Portland Trail Blazers", "Sacramento Kings", "San Antonio Spurs",
            "Toronto Raptors", "Utah Jazz", "Washington Wizards"
            ],
          }
        - { label: "Position", name: "position", widget: "string" }
        - { label: "Injury", name: "injury", widget: "string" }
        - { label: "Cover Image", name: "coverImage", widget: "image" }
        - { label: "Cover Image Alt Text", name: "coverImageAlt", widget: "string" }
        - {
          label: 'Impact',
          name: 'impact',
          widget: 'select',
          multiple: false,
          options: ["Low","Medium","High"],
          }
      sortable_fields: ['date', 'title']
    - label: "Score"
      name: "Score"
      folder: "src/busScreenshots/posts"
      create: true
      slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
      sort: 'date:desc'
      editor:
        preview: false
      fields:
        - { label: "Title", name: "title", widget: "string" }
        - { label: "Cover Image", name: "coverImage", widget: "image" }
        - { label: "Cover Image Alt Text", name: "coverImageAlt", widget: "string" }
      sortable_fields: ['date', 'title']
    - label: "One Pos. Score"
      name: "Pos. Score"
      folder: "src/onePosScreenshots/posts"
      create: true
      slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
      sort: 'date:desc'
      editor:
        preview: false
      fields:
        - { label: "Title", name: "title", widget: "string" }
        - { label: "Week Number", name: "weekNum", widget: "string" }
        - { label: "Cover Image", name: "coverImage", widget: "image" }
        - { label: "Cover Image Alt Text", name: "coverImageAlt", widget: "string" }
      sortable_fields: ['date', 'title']
    - label: "Exclusive Podcasts"
      name: "Exclusive Podcasts"
      folder: "src/exclusivepodcasts/posts"
      create: true
      slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
      sort: 'date:desc'
      editor:
        preview: false
      fields:
        - { label: "Title", name: "title", widget: "string" }
        - { label: "URL ID", name: "urlID", widget: "string" }
      sortable_fields: ['date', 'title']
    - label: "NBA Blog"
      name: "NBA Blog"
      folder: "src/NBA/posts"
      create: true
      slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
      sort: 'date:desc'
      editor:
        preview: false
      fields:
        - { label: "Title", name: "title", widget: "string" }
        - {
          label: 'Author',
          name: 'author',
          widget: 'select',
          multiple: true,
          options: ["William Johnson","Nate Willaims","Tyler Smith","Derrick Others","Ryan White","Miles Jones","Bryan \"The Goon\" Boykin"],
          }
        - { label: "Publish Date", name: "date",   widget: "datetime", default: "",date_format: "YYYY-MM-DD",time_format: "HH:mm",format: "LLL", picker_utc: true}
        - {
          label: 'Blog Categories',
          name: 'categories',
          widget: 'select',
          multiple: true,
          options: ["Top Stories","Injury Analysis"],
          }
        - { label: "Blog Tags", name: "tags", widget: "list" }
        - { label: "Cover Image", name: "coverImage", widget: "image" }
        - { label: "Cover Image Alt Text", name: "coverImageAlt", widget: "string" }
        - { label: "Body", name: "body", widget: "markdown" }
      sortable_fields: ['date', 'title', 'author']