More in this section

Forums / Developing with Sitefinity / Changing date format on news comments

Changing date format on news comments

7 posts, 0 answered
  1. Orion
    Orion avatar
    54 posts
    Registered:
    02 Feb 2009
    25 Jul 2011
    Link to this post
    I am working on a 4.0 site, although I believe this probably applies to even the newest version of 4.1.  Unfortunately, upgrading this site is not an option at this time.

    I'm trying to change the date format on the comments, but not having any luck.  The current format appears to be "dd MM".  I'm trying to change it to "MM dd, yyyy".

    When I edit the the Single Item Settings of the news widget on the page, the area of the widget template for comments doesn't appear to have spot for me to change this.  It looks like this:

    <br><hr noshade size=1 color=black>
            <sf:ContentView
                 id="commentsListView"
                 ControlDefinitionName="NewsCommentsFrontend"
                 MasterViewName="CommentsMasterView"
                 ContentViewDisplayMode="Master"
                 runat="server" />
             <sf:ContentView
                 id="commentsDetailsView"
                 ControlDefinitionName="NewsCommentsFrontend"
                 DetailViewName="CommentsDetailsView"
                 ContentViewDisplayMode="Detail"
                 runat="server" />

    So I went into the Advanced Settings area, under "Comments", and I see a section where you can create date formats.  So I created one, and enabled it, but it's not making any difference on my page.

    Does anybody have experience changing the format of the comment dates?

    Thanks!
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    28 Jul 2011
    Link to this post
    Hi Orion,

    PLease find below the default template we're using for Comments frontend list view.
    <%@ Register TagPrefix="sitefinity" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" %>
    <%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
     
    <sitefinity:ResourceLinks id="resourcesLinks" runat="server">
        <sitefinity:EmbeddedResourcePropertySetter Name="Telerik.Sitefinity.Resources.Themes.EditorContentArea.css" Static="true" ControlID="htmlEditor" ControlPropertyName="ContentAreaCssFile" />
        <sitefinity:ResourceFile Name="Styles/Ajax.css" />
    </sitefinity:ResourceLinks>
     
    <a id="comments"></a>
    <ol id="mainContent" runat="server" class="sfCommentsList">
    </ol>
      
    <sitefinity:GenericCollectionBinder id="clientBinder" runat="server"
        ServiceUrl="~/Sitefinity/Services/Common/Comments.svc"
        TargetId="mainContent"
        BindOnLoad="false"
        DataKeyNames=""
        DataMembers="Author, Comment"
        LoadingPanelID="mainContentLoadingPanel">
        <Containers>
            <sitefinity:BinderContainer ID="BinderContainer1" runat="server" RenderContainer="false" TemplateHolderTag="OL" ContainerTag="LI">
                <li>
                    <strong>{{Author ? Author.DisplayName : "" }}</strong> <em class="sfCommentDate">{{Comment.DateCreated.sitefinityLocaleFormat('dd MMM, yyyy')}}</em>
                    <div class="sfCommentText">{{Comment.Text}}</div>               
                </li>
            </sitefinity:BinderContainer>
        </Containers>
    </sitefinity:GenericCollectionBinder>
    <telerik:RadAjaxLoadingPanel ID="mainContentLoadingPanel" runat="server" Skin="Sitefinity" IsSticky="false" EnableSkinTransparency="false"><asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:Labels, Loading %>" />
    </telerik:RadAjaxLoadingPanel>            
                  
    <asp:Panel ID="addCommentsPanel" runat="server" class="sfSubmitComment">    
        <h2 id="addComment">Comment</h2>
        <telerik:RadEditor ID="htmlEditor" runat="server" Skin="Sitefinity" Width="100%" Height="200"
            EditModes="Design"
            DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd"  >
        </telerik:RadEditor>
        <input id="addNewComment" value="Submit" type="button" class="sfSubmitBtn" />
     
    </asp:Panel>
     You can modify the date fromat directly in it, and then map the template for the comments module, by going to Administration->Settings->Advanced->Controls->ViewMap and create a new viewmap. For HostType, please specify Telerik.Sitefinity.Web.UI.CommentsList and in LayoutTemplatePath type in the app relative path to your customized CommentsList.ascx. If you have any additional questions, please let us know.

    Kind regards,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Tony
    Tony avatar
    29 posts
    Registered:
    30 Dec 2010
    16 Jan 2012
    Link to this post
    I tried this and the site is now down with a very cryptic error. I have restarted the site and cycled the app pool.

    HELP!

    [ArgumentNullException: Value cannot be null.
    Parameter name: key]
       System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +9374513
       Telerik.Sitefinity.Configuration.ConfigElementDictionary`2.Add(TKey key, TElement element) +150
       Telerik.Sitefinity.Configuration.ConfigElementDictionary`2.Add(ConfigElement item) +58
       Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadCollectionElement(ConfigElementCollection collection, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, UpgradingInfo upgradingInfo) +730
       Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, UpgradingInfo upgradingInfo, Boolean isNew, Boolean validateTagName) +392
       Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadPropertyElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, UpgradingInfo upgradingInfo) +327
       Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, UpgradingInfo upgradingInfo, Boolean isNew, Boolean validateTagName) +522
       Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSectionFromReader(ConfigSection section, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean checkForUpgrade, UpgradingInfo& upgradingInfo) +214
       Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSectionFromFile(ConfigSection section, ConfigPolicyHandler policyHandler, String policyName, Boolean withUpgrade) +101
       Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSection(ConfigSection section, ConfigPolicyHandler policyHandler, String policyName) +54
       Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider, ConfigPolicyHandler policyHandler, String policyName, Boolean singlePolicy) +148
       Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider) +16
       Telerik.Sitefinity.Configuration.Config.Get(Boolean safeMode) +164
       Telerik.Sitefinity.Web.UI.SimpleView.get_ResourcesAssemblyInfo() +79
       Telerik.Sitefinity.Web.UI.SimpleView.get_LayoutTemplate() +70
       Telerik.Sitefinity.Web.UI.SimpleView.get_Container() +21
       Telerik.Sitefinity.Web.UI.SimpleView.CreateChildControls() +46
       System.Web.UI.Control.EnsureChildControls() +102
       System.Web.UI.Control.PreRenderRecursiveInternal() +42
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
    

  4. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    18 Jan 2012
    Link to this post
    Hi Tony,

    I'm really sorry to hear about the problems you have experienced. We have tried reproducing the issue locally, so we can study the possible causes, but were not able to. Would it be possible for you to send us a copy of the project files and a backup of the database associated with it so we can debug the problem locally?

    Greetings,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Conrad Ehinger
    Conrad Ehinger avatar
    59 posts
    Registered:
    22 Sep 2009
    20 Jan 2012
    Link to this post
    I followed the instructions you listed however it seemed to have no effect on the comments list. I converted the list to an unordered list and changed the TemplateHolderTag to "UL" on the sitefinity:BinderContainer and theres no visible changes. Do I have to set the template path elsewhere?

    Also the site I am working on is v4.3 Hotfix, in case that matters
  6. Kaveh
    Kaveh  avatar
    6 posts
    Registered:
    22 Feb 2013
    06 Apr 2013 in reply to Boyan Barnev
    Link to this post
    I know this is way late to this post, but I am using 5.4 and having the exact same problem?  What is the solution for this?  Thanks.
  7. Kaveh
    Kaveh  avatar
    6 posts
    Registered:
    22 Feb 2013
    06 Apr 2013 in reply to Orion
    Link to this post
    Did you ever figure this out?   It would help me greatly if I knew the solution.

    Thanks.
7 posts, 0 answered