Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown file dates not saving in UTC format #7171

Open
msm1227 opened this issue Apr 10, 2024 · 0 comments
Open

Markdown file dates not saving in UTC format #7171

msm1227 opened this issue Apr 10, 2024 · 0 comments
Labels
type: bug code to address defects in shipped code

Comments

@msm1227
Copy link

msm1227 commented Apr 10, 2024

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:

<script src="https://cdn.jsdelivr.net/npm/decap-cms@^3.0.0/dist/decap-cms.js"></script>

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']
@msm1227 msm1227 added the type: bug code to address defects in shipped code label Apr 10, 2024
@msm1227 msm1227 changed the title Invalid DateTime on some blog posts but not all (11ty) Markdown files not saving in UTC format Apr 17, 2024
@msm1227 msm1227 changed the title Markdown files not saving in UTC format Markdown file dates not saving in UTC format Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant