<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="108973" data-post-id="108973">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bjunc" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bjunc/120/16781_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bjunc
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think there is more than enough rationale to justify something like this. To be honest, when I first got into Elixir, this was something I looked around for and just assumed it already existed.</p>
<p>Having used datetime formatters in a few languages, I think my favorite has been Moment.js (which isn’t strftime, and is closer to LDML). I even created a version for Elixir (sorry, never shared it). I think the formatting tokens are more intuitive than strftime.</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://momentjs.com/docs/#/displaying/format/">
  <header class="source">
      <img src="https://momentjs.com/static/img/moment-favicon.png" class="site-icon" alt="" width="32" height="32">

      <a href="https://momentjs.com/docs/#/displaying/format/" target="_blank" rel="noopener nofollow ugc">momentjs.com</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://momentjs.com/docs/#/displaying/format/" target="_blank" rel="noopener nofollow ugc">Moment.js | Docs</a></h3>

  <p>This is the most robust display option. It takes a string of tokens and replaces them with their corresponding values.</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>For example, what I created looked like this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">DateTimeFormatter.format(datetime, "YYYY-MM-DD")
{:ok, "2018-12-22"}

DateTimeFormatter.format!(datetime, "M/D, h:mm a")
"12/22, 1:14 pm"

DateTimeFormatter.format(datetime, "[today is] dddd")
{:ok, "today is Saturday"}
</code></pre>
<p>One key difference is multiple characters for the token.  Eg:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">M              1 2 ... 11 12
Mo             1st 2nd ... 11th 12th
MM             01 02 ... 11 12
MMM            Jan Feb ... Nov Dec
MMMM           January February ... November December
</code></pre>
<p>That said, it sounds like you are proposing the ability to substitute formatters? So the default would be strftime, but someone could build a LDML formatter?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="108973" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-strftime-based-calendar-datetime-formatting/18734/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-108973" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="108973"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #32"></div>
  </section>
</div>
    <div class="postbit" id="108974" data-post-id="108974">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="bjunc" data-post="33" data-topic="18734">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bjunc/48/16781_2.png" class="avatar"> bjunc:</div>
<blockquote>
<p>someone could build a LDML formatter?</p>
</blockquote>
</aside>
<p>That someone can even be you! <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20"></p>
<p>But yes, a formatter is just a module, so you can just define your own module if you want to.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="108974" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-strftime-based-calendar-datetime-formatting/18734/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-108974" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="108974"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #33"></div>
  </section>
</div>
    <div class="postbit" id="108978" data-post-id="108978">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bjunc" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bjunc/120/16781_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bjunc
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Ha, well I’d be happy to give it a shot.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="108978" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-strftime-based-calendar-datetime-formatting/18734/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-108978" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="108978"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #34"></div>
  </section>
</div>
    <div class="postbit" id="131363" data-post-id="131363">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kip" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kip/120/1440_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kip
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>ex_cldr Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>With my <a href="https://hex.pm/packages/ex_cldr_dates_times" rel="nofollow">CLDR-based date/time formatter</a> now finally out the door I look forward to serving configuration for <code>strftime</code> whenever its ready for a road test …</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="131363" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-strftime-based-calendar-datetime-formatting/18734/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-131363" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="131363"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #35"></div>
  </section>
</div>
    <div class="postbit" id="148942" data-post-id="148942">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>We have finally implemented a library based on this proposal: <a href="https://github.com/plataformatec/nimble_strftime" class="inline-onebox" rel="nofollow">GitHub - dashbitco/nimble_strftime: A simple and fast strftime-based datetime formatter · GitHub</a></p>
<p>Everyone, please do give it a try in your application! And <a class="mention" href="/u/kip" rel="nofollow">@kip</a>, let us know if it provides the necessary hooks for i18n/l10n.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="148942" data-batch-url="/posts/batch_likers">
                        9
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-strftime-based-calendar-datetime-formatting/18734/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-148942" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="148942"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
    <div class="postbit" id="149020" data-post-id="149020">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kip" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kip/120/1440_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kip
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>ex_cldr Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a>, all good. I think the only thing maybe missing is <code>era</code>, but I see that’s not part of the substitutions anyway.</p>
<p>For those looking to localise formatting with <code>NimbleStrftime</code>, there is now an <a href="https://hex.pm/packages/ex_cldr" rel="nofollow">ex_cldr</a> function to generate the <code>options</code> for <code>NimbleStrftime.format/3</code>.  <a href="https://hex.pm/packages/ex_cldr_dates_times" rel="nofollow">ex_cldr_dates_times</a> is another option for those looking for <a href="https://cldr.unicode.org" rel="nofollow">CLDR</a>-based formatting.</p>
<p><code>MyApp.Cldr.Calendar.strftime_options!/2</code> (where <code>MyApp</code> is any Cldr backend module you’ve defined) provides these options. You’ll need to update to <a href="https://hex.pm/packages/ex_cldr_calendars/1.5.0" rel="nofollow">ex_cldr_calendars version 1.5.0</a>.</p>
<p>Its a <code>!</code> function because if the specified locale is unknown it will raise.</p>
<h3><a name="p-149020-examples-1" class="anchor" href="#p-149020-examples-1" aria-label="Heading link" rel="nofollow"></a>Examples</h3>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex&gt; NimbleStrftime.format(~D[2019-11-03], "%A, %b %d %Y", MyApp.Cldr.Calendar.strftime_options!())
"Sunday, Nov 03 2019"

iex&gt; NimbleStrftime.format(~D[2019-11-03], "%A, %b %d %Y", MyApp.Cldr.Calendar.strftime_options!("fr")) ==
"dimanche, nov. 03 2019"
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="149020" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-strftime-based-calendar-datetime-formatting/18734/38">Post #37</a>
	                </div>
	            </div>
              <div id="likers-container-149020" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="149020"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #37"></div>
  </section>
</div>
    <div class="postbit" id="159716" data-post-id="159716">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kip" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kip/120/1440_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kip
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>ex_cldr Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>With <code>Calendar.strftime/2</code> being merged into Elixir master (from the <a href="https://hex.pm/packages/nimble_strftime" rel="nofollow">NimbleStrftime</a> lib) I’d like to open a proposal on some additional formatting options and gain community feedback.</p>
<p>There are three sub-proposals and any and all feedback is welcome.</p>
<h3><a name="p-159716-weeks-yes-again-with-the-weeks-conversation-1" class="anchor" href="#p-159716-weeks-yes-again-with-the-weeks-conversation-1" aria-label="Heading link" rel="nofollow"></a>Weeks (yes, again with the weeks conversation <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> )</h3>
<p><a href="http://man7.org/linux/man-pages/man3/strftime.3.html" rel="nofollow">Linux strftime</a> has formatting flags for weeks. These being:</p>
<pre><code>   %U     The week number of the current year as a decimal number, range
          00 to 53, starting with the first Sunday as the first day of
          week 01.  See also %V and %W.  (Calculated from tm_yday and
          tm_wday.)

   %V     The ISO 8601 week number (see NOTES) of the current year as a
          decimal number, range 01 to 53, where week 1 is the first week
          that has at least 4 days in the new year.  See also %U and %W.
          (Calculated from tm_year, tm_yday, and tm_wday.)  (SU)

   %W     The week number of the current year as a decimal number, range
          00 to 53, starting with the first Monday as the first day of
          week 01.  (Calculated from tm_yday and tm_wday.)
</code></pre>
<p>Adding this formatting directives would require an update to the <code>Calendar</code> behaviour to provide support.</p>
<p><strong>Options:</strong></p>
<ol>
<li>No need, don’t add</li>
<li>Just add <code>%V</code> for the ISO week number and add <code>Calendar.iso_week_of_year/1</code> to the <code>Calendar</code> behaviour</li>
<li>Maximise compatibility, go with all three and add the callbacks</li>
</ol>
<h3><a name="p-159716-add-support-for-era-2" class="anchor" href="#p-159716-add-support-for-era-2" aria-label="Heading link" rel="nofollow"></a>Add support for Era</h3>
<p><code>Calendar.day_of_era/1</code> returns <code>{day, era}</code> but that’s an integer, not a display format.  <code>Calendar</code> behaviour doesn’t do any display format translation today. The new <code>Calendar.strftime/2</code> does display format translation for <code>AM</code> and <code>PM</code> (and variants). So one approach is to simply enhance <code>Calendar.strftime/2</code> to also map <code>Calendar.ISO</code> eras <code>0 -&gt; display_name</code> and <code>1 -&gt; display_name</code>. And there would need to be agreement on display name (AD versus CE and BC versus BCE).</p>
<p>Era isn’t used in day-to-day formatting for Gregorian calendars except for dates before year 1. It is used as a standard part of formatting Japanese calendars and for some format of Chinese calendars (and derivatives on the 60 year cycle).</p>
<p><code>strftime</code> defines the following directives:</p>
<div class="md-table">
<table>
<thead>
<tr>
<th>Specifier</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>%Ec</td>
<td>Date/time for current era.</td>
</tr>
<tr>
<td>%EC</td>
<td>Era name.</td>
</tr>
<tr>
<td>%Ex</td>
<td>Date for current era.</td>
</tr>
<tr>
<td>%EX</td>
<td>Time for current era.</td>
</tr>
<tr>
<td>%Ey</td>
<td>Era year. This is the offset from the base year.</td>
</tr>
<tr>
<td>%EY</td>
<td>Year for current era.</td>
</tr>
</tbody>
</table>
</div><p>These can be implemented without a change to the calendar behaviour if <code>Calendar.strftime/2</code> treats era like it treats <code>am/pm</code> and provides an internal translation.  It would perhaps be better that both of these (ie <code>am/pm</code> and <code>era</code> translations became behaviours since that would also help in international projects using Gettext or Cldr.</p>
<p><strong>Options</strong></p>
<ol>
<li>Era? Who cares, forget about it</li>
<li>Compatibility is a good idea and implementation seems simple. Do it.</li>
<li>I care about calendars beyond <code>Calendar.ISO</code> so I need this (I’m not holding my breath on this one <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> )</li>
</ol>
<h3><a name="p-159716-localised-number-systems-ie-not-latin-alphabet-3" class="anchor" href="#p-159716-localised-number-systems-ie-not-latin-alphabet-3" aria-label="Heading link" rel="nofollow"></a>Localised number systems (ie not Latin alphabet)</h3>
<p><code>strftime</code> supports localising the date format to use non-latin alphabets. These is also supported in <code>ex_cldr</code> and friends. The default for these directives is to use the Latin alphabet so implementing these directives is quite trivial.  If no configuration is provided in <code>options</code>, use the fallback to the Latin characters.</p>
<p>The formatting directives are:</p>
<div class="md-table">
<table>
<thead>
<tr>
<th>Specifier</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>%Od</td>
<td>Represents the day of the month, using the locale’s alternative numeric symbols, filled as needed with leading 0’s if an alternative symbol for 0 exists. If an alternative symbol for 0 does not exist, the %Od modified conversion specifier uses leading space characters.</td>
</tr>
<tr>
<td>%Oe</td>
<td>Represents the day of the month, using the locale’s alternative numeric symbols, filled as needed with leading 0’s if an alternative symbol for 0 exists. If an alternative symbol for 0 does not exist, the %Oe modified conversion specifier uses leading space characters.</td>
</tr>
<tr>
<td>%OH</td>
<td>Represents the hour in 24-hour clock time, using the locale’s alternative numeric symbols.</td>
</tr>
<tr>
<td>%OI</td>
<td>Represents the hour in 12-hour clock time, using the locale’s alternative numeric symbols.</td>
</tr>
<tr>
<td>%Om</td>
<td>Represents the month, using the locale’s alternative numeric symbols.</td>
</tr>
<tr>
<td>%OM</td>
<td>Represents the minutes, using the locale’s alternative numeric symbols.</td>
</tr>
<tr>
<td>%OS</td>
<td>Represents the seconds, using the locale’s alternative numeric symbols.</td>
</tr>
<tr>
<td>%Ou</td>
<td>Represents the weekday as a number using the locale’s alternative numeric symbols.</td>
</tr>
<tr>
<td>%OU</td>
<td>Represents the week number of the year, using the locale’s alternative numeric symbols. Sunday is considered the first day of the week. Use the rules corresponding to the %U conversion specifier.</td>
</tr>
<tr>
<td>%OV</td>
<td>Represents the week number of the year (Monday as the first day of the week, rules corresponding to %V) using the locale’s alternative numeric symbols.</td>
</tr>
<tr>
<td>%Ow</td>
<td>Represents the number of the weekday (with Sunday equal to 0), using the locale’s alternative numeric symbols.</td>
</tr>
<tr>
<td>%OW</td>
<td>Represents the week number of the year using the locale’s alternative numeric symbols. Monday is considered the first day of the week. Use the rules corresponding to the %W conversion specifier.</td>
</tr>
<tr>
<td>%Oy</td>
<td>Represents the year (offset from %C) using the locale’s alternative numeric symbols.</td>
</tr>
</tbody>
</table>
</div><p><strong>Options</strong></p>
<ol>
<li>Who cares about countries and people that don’t use the Latin alphabet. Forget it.</li>
<li>Good idea - easy to implement, no impact if I’m not doing non-latin alphabet code. Glad to see Elixir embracing global cultures (ok, I’m pitching I know <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> )</li>
</ol> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="159716" data-batch-url="/posts/batch_likers">
                        6
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-strftime-based-calendar-datetime-formatting/18734/39">Post #38</a>
	                </div>
	            </div>
              <div id="likers-container-159716" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="159716"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #38"></div>
  </section>
</div>
    <div class="postbit" id="159747" data-post-id="159747">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="kip" data-post="39" data-topic="18734">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kip/48/1440_2.png" class="avatar"> kip:</div>
<blockquote>
<p>Weeks (yes, again with the weeks conversation <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> )</p>
</blockquote>
</aside>
<p>I believe we can add <code>%V</code> but I would make it calendar specific. So once you change calendars, it will return the week number of said calendars. The default is of course ISO. Does strftime specify a way to get the week of year? Without week of year, I don’t see this being very useful.</p>
<p>About <code>%U</code> and <code>%W</code>, I am honestly not sure, as they seem to be based on gregorian calendars. What would they return for a japanese calendar, for example?</p>
<aside class="quote no-group quote-modified" data-username="kip" data-post="39" data-topic="18734">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kip/48/1440_2.png" class="avatar"> kip:</div>
<blockquote>
<p>Add support for Era</p>
<p>… So one approach is to simply enhance <code>Calendar.strftime/2</code> to also map <code>Calendar.ISO</code> eras <code>0 -&gt; display_name</code> and <code>1 -&gt; display_name</code> .</p>
</blockquote>
</aside>
<p>I agree with this proposal. <code>day_of_era</code> works but we will probably need to use <code>year_of_era</code> to implement all of the modifiers (except the <code>%EC</code> itself).</p>
<p>Regarding “(AD versus CE and BC versus BCE)”, let’s just pick whatever strftime uses/returns.</p>
<aside class="quote no-group" data-username="kip" data-post="39" data-topic="18734">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kip/48/1440_2.png" class="avatar"> kip:</div>
<blockquote>
<p>Localised number systems (ie not Latin alphabet)</p>
</blockquote>
</aside>
<p>I like this proposal too but I wonder if it should simply be an option called <code>:number_formatter</code>. The number formatter is a function that receives the number as an integer and the padding, and it returns a string. You can replace the number formatter to use any numeric alphabet and padding that you want. This seems simpler overall. WDYT?</p>
<hr>
<p>Thanks for writing these down <a class="mention" href="/u/kip" rel="nofollow">@kip</a>. If you want, we can proceed with a PR for era while we discuss the remaining topics. <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="159747" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-strftime-based-calendar-datetime-formatting/18734/40">Post #39</a>
	                </div>
	            </div>
              <div id="likers-container-159747" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="159747"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #39"></div>
  </section>
</div>
    <div class="postbit" id="159936" data-post-id="159936">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kip" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kip/120/1440_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kip
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>ex_cldr Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Looks like I have misunderstood how <code>%EC</code> works (at least on MAC OSX). It just returns the century years:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">kip@Kips-iMac-Pro strftime % ./a.out '%EC'
Result string is "20"
</code></pre>
<p>Therefore I don’t see a compatible path forward for including <code>era</code> formatting in <code>strftime/2</code>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="159936" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-strftime-based-calendar-datetime-formatting/18734/41">Post #40</a>
	                </div>
	            </div>
              <div id="likers-container-159936" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="159936"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #40"></div>
  </section>
</div>
    <div class="postbit" id="159959" data-post-id="159959">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>So there is no way to get the actual era name in strftime?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="159959" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-strftime-based-calendar-datetime-formatting/18734/42">Post #41</a>
	                </div>
	            </div>
              <div id="likers-container-159959" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="159959"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>