Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Preview is not displayed, php date format error #125

Closed
spalz opened this issue Sep 29, 2019 · 4 comments
Closed

Preview is not displayed, php date format error #125

spalz opened this issue Sep 29, 2019 · 4 comments

Comments

@spalz
Copy link

spalz commented Sep 29, 2019

img-2019-09-29-16-08-00

img-2019-09-29-16-12-24

2019-09-29T09:25:52.317Z
I tried to put various formats, all to no avail

config.json

{
   "generator_name":"facebook-instant-articles-builder",
   "generator_version":"0.2.0",
   "rules":[
      {
         "class":"TextNodeRule"
      },
      {
         "class":"GlobalRule",
         "selector":"html",
         "properties":{
            "article.title":{
               "attribute":"content",
               "selector":".css-1qtfblh-SInfoName",
               "type":"element"
            },
            "article.publish":{
               "attribute":"datetime",
               "format":"D, j M Y H:i:s O",
               "selector":".CrearedAt",
               "type":"date"
            },
            "author.name":{
               "attribute":"content",
               "selector":"meta[name=\"author\"]",
               "type":"string"
            },
            "image.url":{
               "attribute":"content",
               "selector":"meta[property=\"og:image\"]",
               "type":"string"
            },
            "article.body":{
               "selector":".SContentEditor",
               "type":"element"
            },
            "article.canonical":{
               "attribute":"content",
               "selector":"meta[property=\"og:url\"]",
               "type":"string"
            }
         }
      },
      {
         "class":"BlockquoteRule",
         "selector":"blockquote"
      },
      {
         "class":"ParagraphRule",
         "selector":"p"
      },
      {
         "class":"H2Rule",
         "selector":"h2"
      },
      {
         "class":"H1Rule",
         "selector":"h1"
      },
      {
         "class":"ListElementRule",
         "selector":"ol, ul"
      },
      {
         "class":"ListItemRule",
         "selector":"li"
      },
      {
         "class":"AnchorRule",
         "selector":"a",
         "properties":{
            "anchor.href":{
               "attribute":"href",
               "selector":"a",
               "type":"string"
            }
         }
      },
      {
         "class":"ItalicRule",
         "selector":"i"
      },
      {
         "class":"EmphasizedRule",
         "selector":"em"
      },
      {
         "class":"BoldRule",
         "selector":"b, strong"
      },
      {
         "class":"ImageRule",
         "selector":"img",
         "properties":{
            "image.url":{
               "attribute":"src",
               "selector":"img",
               "type":"string"
            },
            "image.caption":{
               "attribute":"src",
               "selector":"img",
               "type":"element"
            }
         }
      },
      {
         "class":"IgnoreRule",
         "selector":".STopImage"
      },
      {
         "class":"IgnoreRule",
         "selector":".EditorJsLinkTool img"
      },
      {
         "class":"IgnoreRule",
         "selector":".ComponentSelector"
      },
      {
         "class":"IgnoreRule",
         "selector":".ContentNext"
      },
      {
         "class":"IgnoreRule",
         "selector":".ContentNavigation"
      },
      {
         "class":"IgnoreRule",
         "selector":".ArticleAuthorAvatar"
      },
      {
         "class":"IgnoreRule",
         "selector":".ArticleTop"
      },
      {
         "class":"IgnoreRule",
         "selector":"header"
      }
   ]
}
@smendis
Copy link

smendis commented Oct 17, 2019

I have the same issue (No Preview/Source and Date Format issue). I'm running Instant Article Builder in Windows. I even tried getting the latest source. Still the same issue. I see this on the console.
image

@growlead
Copy link

Please use format "c".

@demetrox
Copy link

demetrox commented Apr 8, 2020

for the date-time format just go to your Wordpress admin--> setting --> general --> date format --> copy-paste the format you use. For me, I'm using F j, Y format

@pestevez
Copy link
Contributor

Thanks for reporting and thanks to those that chimed in. A couple of thoughts before getting to the specific examples:

  1. We are thinking about enhancing the way we treat dates, I think the best way to go is to be smarter when parsing the standard meta tags that exist to cover publication and modification times. (Treatment of DateTime attributes #43)
  2. This field is not mandatory and will default to the actual time if we don't have the date at the time the Instant Article is created.

With that said, here are the correct formats for the examples provided in this issue:

  • 23 September 2019 --> d F Y OR j FY, depending on how many digits are used for the day of the month.
  • 15 Agustus 2019 --> also d F Y OR j FY.
    • The issue here is that the attribute that you are using has dashes and not spaces (as seen in the screenshot "2019-08-15").
    • One solution would be to use Y-m-d instead or to use the text value as attribute (although I am not sure it is possible. See Treatment of DateTime attributes #43)

I am closing the issue now. I suggest seeing this page for a list of available format options.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants