.PublishDate doesn't work: 0001-01-01

Continuing the discussion from Why is .PublishDate set to 0001-01-01 00:00:00 +0000 UTC?:

I read :point_up_2:, but still i can’t handle this.

my layouts/_default/single.html:

{{ define "main" }}

<title>{{.Title}}</title>

<h1>{{.Title}}</h1>
<aside>
    <p style="text-align: right;">
        {{.Params.idx}}
{{ $categories := .Params.categories }}
    {{ $all_categories := .Site.Taxonomies.categories }}
    {{ with $categories }}
        {{- range $all_categories -}}
            {{ if in $categories .Page.Title }}
            <a href="{{- .Page.Permalink -}}" style="color: black">{{ .Page.Title }}</a>&emsp;
            {{ end }}
        {{- end }}
    </span>
    {{ end }}
    작성일: {{ .PublishDate.Format "2006-01-02" }}&nbsp;<br>
    작성자: {{$.Param "author"}} 사장 &nbsp;
</p>
</aside>

{{ if and (gt .WordCount 1000 ) }}
<aside>
    <b>목차</b>
    {{.TableOfContents}}
</aside>

{{ end }}
{{.Content}}
{{end}}

(.PublishDate.Format is in line 19)

hugo_issue.md:

---
title: "publishdate"  # 국문 타이틀
slug: "hugo_issue"
publishdate: "2017-4-23T20:55:58-06:00"
author: "류대식"
categories: ["hugo_issue", ""]
tags: ["", ""]
weight: 600
idx: 1
aliases: 
    - issue
---

## sdf

asdf

Rendered:

I tried:

How can I get the correct publish date? Thanks!

I cannot replicate your issue.

Do you have your code in a repo somewhere?

hugo_issue.md:
https://github.com/freshrimpsushi/admin/blob/master/content/hugo_issue.md

web page:
https://freshrimpsushi.github.io/hugo_issue/

I fixed it.
The format “YYYY-MM-DD” is important.

publishdate: “2018-3-31” :x:

publishdate: “2018-03-31” :ok_hand:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.