title: How to show date once per day from an array with multiple timestamps
body: <p>I have an array with multiple conversations and with every message that has been typed either by the user or by the admin a timestamp indicating at what time the message was sent. A conversation can end on the same day or it can continue the day after it was started or a week, month even a year later.</p>
  
  <p>I want to show the day (example: 7 MAY 2015) on the page indicating that the conversation is started today. And if the conversation is picked up on a later date i want to show that date of the day (example: 8 MAY 2015).</p>
  
  <p>I am using AngularJS and I have search for a example of a chat application or similar but I have not found a good example nor have I found a tutorial.</p>
  
  <p>Her is my array with the conversations:</p>
  
  <pre><code>conversationList.conversations = [
       {
          ConversationID: 1,
          Person   : {
              name  : "Bobi Ristov",
              email : "bobby.ristov@socialdeal.nl",
              image : "/img/bobi.png",
              phone : "06 - 12345678"
          },
          Messages : [ {
                           text         : "Ik heb een vraag",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257762800
                       },
                       {
                           text         : "Wat is je vraag?",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429257942900
                       },
                       {
                           text         : "Hoe kun je een deal kopen?",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257763000
                       },
                       {
                           text         : "Door middel op de 'Koop nu' knop te drukken",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429259943100
                       },
                       {
                           text         : "Ik heb een vraag",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257762800
                       },
                       {
                           text         : "Wat is je vraag?",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429257942900
                       },
                       {
                           text         : "Hoe kun je een deal kopen?",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257763000
                       },
                       {
                           text         : "Door middel op de 'Koop nu' knop te drukken",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429259943100
                       },
                       {
                           text         : "Ik heb een vraag",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257762800
                       },
                       {
                           text         : "Wat is je vraag?",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429257942900
                       },
                       {
                           text         : "Hoe kun je een deal kopen?",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257763000
                       },
                       {
                           text         : "Door middel op de 'Koop nu' knop te drukken",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429259943100
                       },
                       {
                           text         : "Ik heb een vraag",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257762800
                       },
                       {
                           text         : "Wat is je vraag?",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429257942900
                       },
                       {
                           text         : "Hoe kun je een deal kopen?",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257763000
                       },
                       {
                           text         : "Door middel op de 'Koop nu' knop te drukken",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429259943100
                       },
                       {
                           text         : "Ik heb een vraag",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257762800
                       },
                       {
                           text         : "Wat is je vraag?",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429257942900
                       },
                       {
                           text         : "Hoe kun je een deal kopen?",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257763000
                       },
                       {
                           text         : "Door middel op de 'Koop nu' knop te drukken",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429259943100
                       },{
                           text         : "Ik heb een vraag",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257762800
                       },
                       {
                           text         : "Wat is je vraag?",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429257942900
                       },
                       {
                           text         : "Hoe kun je een deal kopen?",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257763000
                       },
                       {
                           text         : "Door middel op de 'Koop nu' knop te drukken",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429259943100
                       },{
                           text         : "Ik heb een vraag",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257762800
                       },
                       {
                           text         : "Wat is je vraag?",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429257942900
                       },
                       {
                           text         : "Hoe kun je een deal kopen?",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257763000
                       },
                       {
                           text         : "Door middel op de 'Koop nu' knop te drukken",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429259943100
                       },{
                           text         : "Ik heb een vraag",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257762800
                       },
                       {
                           text         : "Wat is je vraag?",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1429257942900
                       },
                       {
                           text         : "Hoe kun je een deal kopen?",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257763000
                       },
                       {
                           text         : "Door middel op de 'Koop nu' knop te drukken",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1430745187000
                       } ]
      },
       {
          ConversationID: 2,
          Person   : {
              name  : "Rene Jaspers",
              email : "rene@socialdeal.nl",
              image : "/img/rene.png",
              phone : "06 - 87654321"
          }
          ,
          Messages : [ {
                           text         : "This is a second user message",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257762500
                       },
                       {
                           text         : "This is a second admin message",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1430655187000
                       } ]
      },
       {
          ConversationID: 3,
          Person   : {
              name  : "Jafeth van Gorp",
              email : "jafeth@socialdeal.nl",
              image : "/img/jafeth.png",
              phone : "06 - 12348765"
          }
          ,
          Messages : [ {
                           text         : "This is a third user message",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257763000
                       },
                       {
                           text         : "This is a third admin message",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1430565187000
                       } ]
      },
       {
          ConversationID: 4,
          Person   : {
              name  : "Peter Covers",
              email : "peter@socialdeal.nl",
              image : "/img/peter.png",
              phone : "06 - 87654321"
          }
          ,
          Messages : [ {
                           text         : "This is a fourth user message",
                           messageClass : "user-message",
                           animationClass: "user-reply",
                           time         : 1429257763000
                       },
                       {
                           text         : "This is a fourth admin message",
                           messageClass : "admin-message pull-right",
                           animationClass: "reply",
                           time         : 1430475187000
                       } ]
      },
       {
           ConversationID: 5,
           Person   : {
               name  : "John Doe",
               email : "john@doe.com",
               image : "http://s3.amazonaws.com/overlayer/photo/imgs/original/GToGIYGDmaKZPxBrCREVvwVT.png?1354821570",
               phone : "06 - 87654321"
           }
           ,
           Messages : [ {
                            text         : "This is a fourth user message",
                            messageClass : "user-message",
                            animationClass: "user-reply",
                            time         : 1429257763000
                        },
                        {
                            text         : "This is a fourth admin message",
                            messageClass : "admin-message pull-right",
                            animationClass: "reply",
                            time         : 1430385187000
                        } ]
       },
       {
           ConversationID: 6,
           Person   : {
               name  : "Jane Doe",
               email : "jane@doe.com",
               image : "http://motherscircle.net/wp-content/uploads/2012/12/smiling-woman-in-glasses.jpg",
               phone : "06 - 87654321"
           }
           ,
           Messages : [ {
                            text         : "This is a fourth user message",
                            messageClass : "user-message",
                            animationClass: "user-reply",
                            time         : 1429257763000
                        },
                        {
                            text         : "This is a fourth admin message",
                            messageClass : "admin-message pull-right",
                            animationClass: "reply",
                            time         : 1427879587000
                        } ]
       }
  ];
  </code></pre>
  
  <p>Here is the HTML:</p>
  
  <pre><code>&lt;div sd-slimscroll sd-height="auto" sd-color="#878787"  sd-always-visible="true" sd-size="5px" class="conversation-container"&gt;
  &lt;!-- WHOLE MESSAGE FROM USER/ADMIN (INCLUDING DATE) --&gt;
  &lt;div class="{{ message.animationClass }}" ng-repeat="message in conversation.Messages"&gt;
      &lt;!-- DATE --&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-lg-12"&gt;
              &lt;div class="date text-center"&gt;
                  {{ message.time | date: "dd MMMM yyyy" }}
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;!-- WHAT THE USER/ADMIN HAS TYPED --&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-lg-12"&gt;
              &lt;div class="media {{ message.messageClass }}"&gt;
                  &lt;div class="media-body"&gt;
                      &lt;h5 class="media-heading"&gt;{{conversation.Person.name}}&lt;/h5&gt;
                      {{ message.text }} &lt;img class="img-responsive" ng-show="message.imageURL" src="{{ message.imageURL }}"/&gt;&lt;br /&gt;
                      &lt;div class="message-time"&gt;{{ message.time | date: "HH:mm" }}&lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>I am stuck. Any help would be appreciated.</p>