New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add info about HTML and JS new features #327
base: gh-pages
Are you sure you want to change the base?
Conversation
@xfq i just came across this. Do you want to continue to make these changes? If so, i think we need to solve the conflicts first. Then i have a number of suggestions ranging from organisation of sections to typos. |
Yes. I have resolved the conflicts. |
ac0a810#diff-925e46831aa6b3e93b26574309eda5813c4092dc831e2dfa6757c86b0a167c72 is showing a massive number of changes to the repo. I'm not sure what that's about, and whether it means all the files mentioned will be updated (which is not a good idea). Could you take a look and let me know? |
That's normal, as I need to resolve the merge conflicts. Those modifications are already in the |
In addition, some more explanation. When some branch is created at 100th history of HEAD, and bunch of updates are committed to HEAD during discussion held in PR of the branch - like 170th HEAD, the branch is ahead of HEAD over 70 commits. If there is conflict(s) between PR and ones during 70 commits, conflicted file(s) are required to be resolved. For this, there are several ways, like:
For the last, commit for merging all changes (e.g. 100th to 170th in example above) will be shown lie ac0a810, but |
Thanks for your explanation, @himorin! |
HTML5 introduced <code class="kw" translate="no">input</code> elements of type <code>date</code>, <code>time</code>, <code>datetime-local</code>, <code>month</code>, and <code>week</code>, which let the user easily enter a date or a time, like: | ||
</p> | ||
|
||
<div style="margin-inline-start: 25px;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should one make of the fact that my browsers (Gecko, Blink, and WebKit) all present the selected date with the order DD-MM-YYYY? This is not the ISO order we talk about later. It's also a purely numeric number format, which we discourage later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there ways to adapt the displayed date in the input control to local approaches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my computer (macOS), Firefox uses DD/MM/YYYY
and Chrome uses YYYY/MM/DD
. My language preference in both browsers is English (GB), so I'm not sure what would affect this either.
|
||
<div style="margin-inline-start: 25px;"> | ||
<p> | ||
<label for="date"><input type="<strong>date</strong>"></label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we probably need to talk about 'storage' in this section too – ie. what happens when a user selects a date? How can the content author get at that information and what format is it in?
We may need to decide whether it's appropriate to describe something similar to https://html.spec.whatwg.org/multipage/forms.html#writing-a-form's-user-interface (though specific to date/time formats).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we probably need to talk about 'storage' in this section too – ie. what happens when a user selects a date? How can the content author get at that information and what format is it in?
Thanks. Added.
We may need to decide whether it's appropriate to describe something similar to https://html.spec.whatwg.org/multipage/forms.html#writing-a-form's-user-interface (though specific to date/time formats).
I personally don't think it's necessary, unless you have good scenario suggestions.
questions/qa-date-format.en.html
Outdated
<p> | ||
<label for="date"><input type="<strong>date</strong>"></label> | ||
<input type="date" id="date" name="date" | ||
value="2021-12-07" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that these pickers are mostly useful for picking a date that is close to the current date. For example, it appears to be difficult to select a date such as 12 Dec 1876.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. Do you think we need to mention this limitation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried it again, and it seems that you can directly modify the text without using the special UI to select. This way, it's not that difficult to specify a date decades ago.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, i realised later that i was unable to do that because that example had limits applied to it :(
questions/qa-date-format.en.html
Outdated
</p> | ||
|
||
<p> | ||
<a href="https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#dates-and-times">HTML</a> uses a variation of the <a href="https://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> standard for its date and time strings. The date and time strings do not include the time zone data. The time zone data can be stored on the server-side separately if needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, how does one allow a user to specify the time zone? Is it picked up automatically from their system? etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They can use getTimezoneOffset()
. I added that to the article.
questions/qa-date-format.en.html
Outdated
<h2 id="input">User input</h2> | ||
|
||
<p> | ||
When it comes to accept data from the user, we usually use the <code class="kw" translate="no">input</code> element in HTML. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the objective of this section? Currently it just lists a few items of information about date/time selection, but how does that tie into the tasks that a content author is faced with? What are the pros and cons of the approaches listed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rewrote this paragraph to add the task that a content author is faced with.
Aside from the possible interop issue, I don't see any significant downsides of using a special date picker interface.
questions/qa-date-format.en.html
Outdated
</p> | ||
|
||
<p> | ||
Maybe you're using your customized date and time picker and not planning using the <code class="kw" translate="no">input</code> element, but you need to store it in a standard format to be able to share it with others. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And what is that standard format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This paragraph may belong at the beginning of the section, to set up the idea that you can either create a custom control or use one of the ready-made controls provided by the browser. The section would then set about giving recommendations about which to use and how to use them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also mention that if you use a custom control you need to understand the input the user provided, which may be in various different formats, and you need to validate the format sent to the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And what is that standard format?
ISO 8601 would be the most widely used format.
This paragraph may belong at the beginning of the section, to set up the idea that you can either create a custom control or use one of the ready-made controls provided by the browser. The section would then set about giving recommendations about which to use and how to use them.
Fixed.
FYI - here are some custom controls I've seen:
questions/qa-date-format.en.html
Outdated
</p> | ||
|
||
<p> | ||
You can set a default value for the input by using the <code>value</code> attribute or restrict the date or time using the <code>min</code> and <code>max</code> attributes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And step. What about 12 vs 24 hour clock settings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we mention the autocomplete features?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of the 'storage' topic: if you set a default value, it needs to follow the ISO format, not the local order/composition. We should describe that, i think.
You may find some inspiration from https://html.spec.whatwg.org/multipage/forms.html#input-author-notes (especially the latter half of that subsection).
<p>Use <code>$ENV{'HTTP_ACCEPT_LANGUAGE'}</code> to get the preferred language. Use <code>POSIX:strftime</code> to format date values. | ||
You'll have to do your own mapping of the accepted languages value to a date format string.</p> | ||
</div> | ||
<p>How this is done will vary depending on your development environment.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The section "Store and display a date" also seems to lack focus. In fact, i think it's trying to do 2 separate things:
- describe how local date/time formats can be different and problematic, and what works or doesn't work if you try to use a generic format
- describe how to produce dates and times in your code (one method described is that using JavaScript – but it doesn't mention the time element in HTML
Is option 3 really something useful these days? Or is it part of the discussion "How language interacts with date/time settings and where to get the language from" ?
@@ -3,15 +3,15 @@ | |||
<head> | |||
<meta charset="utf-8" /> | |||
<title>Date formats</title> | |||
<meta name="description" content="How do I prepare my web pages to display varying international date formats?" /> | |||
<meta name="description" content="How do I manage date formats on a web page?" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This review focuses mainly on the first section of the document. There are lots of comments: don't feel overwhelmed. I'm basically trying to understand what is the need of the content author that we are addressing, and how best to meet that/those need(s). The initial scope of the article was fairly limited and specific (albeit perhaps in need of updating). We've widened that scope significantly here and we need to, i think, in our minds have more clear vision of what we are trying to achieve and more rigorous control over what text we use to achieve the goal. Part of that involves also deciding to what exent we describe the how-to steps in this article and give example, compared with pointing off to other sources for those things.
✅ Deploy Preview for i18n-drafts ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Fix #7.
Changes:
Date
object (I choose not to mention Temporal for now, because I want to wait until there are at least two shipping implementations)