How to show article author and article created date on homepage

2 Commentaires

  • Darenne
    Zendesk Customer Care

    Hi Ronit

    Due to some information that I need to clarify, I'll go ahead and create a ticket for this concern. 

    0
  • Pulkit Pandey
    Community Moderator

    Hi Ronit

    Here is the solution for your second problem which you have listed above 

     var date = new Date("2023-06-03T19:36:12Z");
    var dateString = new Date(date.getTime() - (date.getTimezoneOffset() * 60000 ))
                        .toISOString()
                        .split("T")[0];
      
    function dateFormater(date) {
      var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
      var day = date.getDate();
      // get month from 0 to 11
      var month = date.getMonth();
      // conver month digit to month name
      month = months[month];
      var year = date.getFullYear();

      // show date in two digits
      if (day < 10) {
        day = '0' + day;
      }

      // now we have day, month and year
      // arrange them in the format we want
      return  day + ' ' + month + ' ' + year;
        
        
      }
      
      var dt = dateFormater(new Date(dateString));
      
      console.log(dt);

    Let me know if it solves your issue 

     

    Thank You 

    Pulkit

    Team Diziana

    0

Vous devez vous connecter pour laisser un commentaire.

Réalisé par Zendesk