• GitHub
  • Documentation
  • Discord
  • Tip
search
  • chevron_right Threads
  • label Feedback

Suggestion on Date&Time Displaying

xohozu
June 18, 2014
chat_bubble_outline 8
  • link
    xohozu
    Contributor 22 posts
    June 18, 2014, 11:56 a.m. June 18, 2014, 11:56 a.m.
    link

    We have known that Misago have supported i18n well. However, I found an interesting problem on time displaying today. For example, the time string "Friday, 9:33 p.m." will show in en_US locale and in zh_CN locale it will be "星期五,9:33 p.m.". It is an absolute right expression, is it ? However, maybe "星期五,下午9:33" is more reasonable for chinese. I think it will be an issue in many countries.
    So, I start to review Misago's codes. Finally, I found that it's not Misago's fault but Django's. Because it does not translate 'p.m.' into '下午' in locale/zh_CN/LC_MESSAGES/django.po.
    However, Misago can fix it and does better.

    misago/utils/datesformats.py
    # Build date formats
    formats = {
        'DATE_FORMAT': '',
        'DATETIME_FORMAT': '',
        'TIME_FORMAT': '',
        'YEAR_MONTH_FORMAT': '',
        'MONTH_DAY_FORMAT': '',
        'SHORT_DATE_FORMAT': '',
        'SHORT_DATETIME_FORMAT': '',
    }
    
    for key in formats:
        formats[key] = get_format(key).replace('P', 'g:i a')
    

    In above codes which locate in misago/utils/datesformats.py, it just replaced 'P' into 'g:i a' of format string. An simple approach is using 24-hour time format to display can work well according to my proposed. For example, formats[key] = get_format(key).replace('P', 'G:i').
    I recommend that admin can easily define date & time format string in Admin Control Panel.

  • link
    rafalp
    Project Lead 2028 posts
    June 18, 2014, 5:18 p.m. June 18, 2014, 5:18 p.m.
    link

    Just a heads up that Misago timehandling code will be deprecated for sake of client-side Moment.js in 0.6

  • link
    xohozu
    Contributor 22 posts
    June 18, 2014, 5:23 p.m. June 18, 2014, 5:23 p.m.
    link
    @rafalp

    Just a heads up that Misago timehandling code will be deprecated for sake of client-side Moment.js in 0.6

    When the 0.6 version will be released formally?

  • link
    rafalp
    Project Lead 2028 posts
    June 18, 2014, 5:35 p.m. June 18, 2014, 5:35 p.m.
    link

    When its done.

  • link
    xohozu
    Contributor 22 posts
    June 18, 2014, 5:41 p.m. June 18, 2014, 5:41 p.m.
    link
    @rafalp

    When its done.

    Haha, it's an interesting answer.

  • link
    rafalp
    Project Lead 2028 posts
    June 18, 2014, 5:55 p.m. June 18, 2014, 5:55 p.m.
    link

    Such is life. I am not working at Misago fulltime, thus I can't really judge how will 0.6 progress.

    Did you check how Moment.js handles chinese times?

  • link
    xohozu
    Contributor 22 posts
    June 18, 2014, 6:09 p.m. June 18, 2014, 6:09 p.m.
    link

    Oh, I see. Can I ask your question? Are you still a college student or working in a company?
    I looked Moment.js, it can performs well. I will check it in deep later.

  • link
    rafalp
    Project Lead 2028 posts
    June 18, 2014, 6:27 p.m. June 18, 2014, 6:27 p.m.
    link

    I've graduated two months ago and am currently working with friend on my own startup. My sleep pattern and dialy activities are messed up :laughing:, but I am still fonding enought time to move 0.6 forward.

    xohozu likes this.

    favorite 1

  • link
    xohozu
    Contributor 22 posts
    June 18, 2014, 7:07 p.m. June 18, 2014, 7:07 p.m.
    link
    @rafalp

    I've graduated two months ago and am currently working with friend on my own startup. My sleep pattern and dialy activities are messed up :laughing:, but I am still fonding enought time to move 0.6 forward.

    It's so excited.
    I noticed that you have added some tags for threads. I added two prefix in admincp, but how it is used to group threads? After much attempts, I failed.

arrow_upward Go to top
  • This site uses cookies to gather statistical data for use in traffic analysis.
  • GitHub
  • Documentation
  • Discord
  • Tip
  • Terms of service
  • Privacy policy
powered by misago