Skip to content
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

Open
wants to merge 20 commits into
base: gh-pages
Choose a base branch
from
Open

Conversation

xfq
Copy link
Member

@xfq xfq commented Dec 2, 2021

Fix #7.

Changes:

  • Remove "intended audience"
  • Change the question from "How do I prepare my web pages to display varying international date formats?" to "How do I manage date formats on a web page?"
  • Divide the article into two parts: input and output of dates
  • Mention the date & time markup in HTML5
  • Mention the JavaScript Date object (I choose not to mention Temporal for now, because I want to wait until there are at least two shipping implementations)
  • Remove the information on Java/JSP, ASP, and Perl. I don't think these can provide much guidance to developers nowadays, because Java/Spring and PHP are much more popular.

@xfq xfq requested a review from r12a December 2, 2021 11:51
@r12a
Copy link
Contributor

r12a commented Aug 16, 2022

@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.

@xfq
Copy link
Member Author

xfq commented Aug 17, 2022

Do you want to continue to make these changes?

Yes. I have resolved the conflicts.

@r12a
Copy link
Contributor

r12a commented Aug 17, 2022

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?

@xfq
Copy link
Member Author

xfq commented Aug 17, 2022

That's normal, as I need to resolve the merge conflicts. Those modifications are already in the gh-pages branch.

@himorin
Copy link
Contributor

himorin commented Aug 17, 2022

That's normal, as I need to resolve the merge conflicts. Those modifications are already in the gh-pages branch.

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:

  • take updates between 100th and 170th HEAD, per file which is modified within the PR (named as resolve conflict button on merging)
  • just rebase from 100th to 170th HEAD, like modify history of PR from '100th HEAD -> commit for PR' to '170th HEAD -> commit for PR', which results to modify the PR as started from 170th HEAD
  • merge from origin/HEAD to the PR, which applies all modification happened on HEAD, like taking all commits between 100th and 170th into the PR (history will be 100th HEAD -(fork)-> commit for PR -> all changes between 100-170)

For the last, commit for merging all changes (e.g. 100th to 170th in example above) will be shown lie ac0a810, but Files changed tab in PR will show will show only changes between 170th HEAD and the PR which is similar to the original change for the PR.

@xfq
Copy link
Member Author

xfq commented Aug 17, 2022

Thanks for your explanation, @himorin!

questions/qa-date-format.en.html Outdated Show resolved Hide resolved
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;">
Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Member Author

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">&lt;input type="<strong>date</strong>"&gt;</label>
Copy link
Contributor

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).

Copy link
Member Author

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.

<p>
<label for="date">&lt;input type="<strong>date</strong>"&gt;</label>
<input type="date" id="date" name="date"
value="2021-12-07"
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Member Author

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.

Copy link
Contributor

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 :(

</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.
Copy link
Contributor

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.

Copy link
Member Author

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.

<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.
Copy link
Contributor

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?

Copy link
Member Author

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.

</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.
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Member Author

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:

</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.
Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Contributor

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>
Copy link
Contributor

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:

  1. 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
  2. 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?" />
Copy link
Contributor

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.

@netlify
Copy link

netlify bot commented Feb 8, 2023

Deploy Preview for i18n-drafts ready!

Name Link
🔨 Latest commit a7643ad
🔍 Latest deploy log https://app.netlify.com/sites/i18n-drafts/deploys/63e3a9d009057a0008dbc5b6
😎 Deploy Preview https://deploy-preview-327--i18n-drafts.netlify.app/questions/qa-date-format.en
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@w3c w3c deleted a comment from netlify bot Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[questions/qa-date-format] add info about html5 date markup
3 participants