Date/Time Inputs Enabled on Firefox Nightly
blog.nightly.mozilla.org
blog.nightly.mozilla.org
Japanese often uses 24 hour times like 18:00 vs 6:00pm and while I see you can specify valid times in that format I didn't see how to get it to display 18:00 instead of 6:00pm.
In the forms on this page
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/in...
When I typed 20:00 it assumed that first 2 meant 2am and then jumped to the minutes section as soon as I typed 2. Note: My system settings are set to use 24 hour time.
Worse, Japanese times are often in terms of the night before. So for example if you look at movie times a movie playing at 1:00am Saturday morning is listed as 25:00 Friday night.
I wonder if input type=time is probably going to cause more trouble than it's worth
https://modelviewculture.com/pieces/i-can-text-you-a-pile-of...
Now I live in the UK, and I still have to convert my friends to be using 24 hour clocks, maybe it will help if I start showing up at their houses at 05:00 instead of 17:00 :D
I am not sure of the hours because I haven't actively watched TV for years but it was certainly the case when I was a kid in the 80's where TV was not 24/24 but ended sometime in the night. It was then natural for the next day to start at 9 or whatever was the earliest broadcast.
EDIT: oh I see, automatically adjusted, but not configurable. Bad choice it is, then.
EDIT2: I mean, there are so many more better and easy solutions to that problem. You could display a date with a month name in the selected language - "Oct 1, 2017" - or start with a year "2017-10-01" which would be instantly recognizable by anyone regardless of the country.
Ideally the application should read the system regional setting and use that. For example, my macOS uses English as language and Finnish as region. (I've no idea if the system provides an API for reading regional settings, though.)
The MacOS system, of course, provides APIs to get language and locale settings (for dates, number formatting, etc.) separately.
The JavaScript environment, on the other hand, doesn't really have any good APIs that properly separate preferred language from other things like units (metric vs. imperial), formatting dates and times, currencies, and so on.
I was hoping this would be an improvement to the state of JavaScript wrt. locales. Sadly, it looks like this build of Firefox Nightly still doesn't do dates correctly on MacOS, and this is just as broken as everything that came before it.
I have language, dates, number formatting, and everything set up just the way I like it in the OS settings, why the web/JS world just doesn't use those settings is beyond me.
You could implement the locale-less Intl.DateTimeFormat or Intl.NumberFormat such that they get the current formatting settings regardless of locale data.
The browser ought do that automatically, that it does not is the issue at hand. I was just pointing out that the Intl API does not seem to preclude implementing this behaviour, it still needs to be implemented. Which first means that it should be reported to Firefox's bug tracker (I have not seen a single link to FF's bugzilla in any of the subthreads).
It makes no sense whatsoever and the US seem to be the only place in the world to use mm/dd/yyyy excluding a few countries in Africa (and even there it's not the most popular format):
https://i.guim.co.uk/img/static/sys-images/Guardian/Pix/pict...
And for this reason the ISO standard is yyyy-mm-dd, big endian just like writing numbers; and it sorts (numerically not lexigraphically) properly too!
I'll dub this "the year 10000" problem.
http://longnow.org/about/ "The Long Now Foundation uses five-digit dates, the extra zero is to solve the deca-millennium bug which will come into effect in about 8,000 years."
ps.: Thursday is also Jupiter's day, so it will probably prevail on any colony / permanent human station orbiting it/it's moons.
pps.: I hope they get over the stupid imperial vs. metric divide though.. that one is really annoying.
Other formats don’t make sense.
"Dates: Put the day before the month (eg: 12 April 2001)”
http://www.bbc.co.uk/academy/journalism/article/art201307021...
Because of the way you say it in English?
" English is the official language of 32 states; English and Hawaiian are both official languages in Hawaii, and English and 20 Indigenous languages are official in Alaska. Algonquian, Cherokee, and Sioux are among many other official languages in Native-controlled lands throughout the country. French is a de facto, but unofficial, language in Maine and Louisiana, while New Mexico law grants Spanish a special status."
Nothing that you have said has explained why anybody should make a change to the date format.
If I understand you correctly, this is something I strongly disagree with. Many people are bilingual if not more, so when I have two tabs from different sites I prefer the dates to be consistent. At least on my Linux machine I want those to be driven by my locale settings, which lets me choose UK English, US English or 50 other conventions if I so desire.
I routinely run terminals with different locales set on the same screen and I would like programs started from those not get smart about locale choices but rather do exactly as I ask. Just my poor user 2c.
I am bilingual myself, and I strongly prefer each context to be self-consistent. When reading English text I find Norwegian date formatting confusing, and vice versa. I routinely have open tabs in different languages.
Why must it then be in Danish? Because we would rather optimize for Danish users who for some reason have gotten the wrong browser version / localization settings and don't know how to change it.
An English speaking user would be much better served with a dedicated English version than just the date format being correct - if they can overcome the language barrier, surely they can overcome the date format.
Otherwise the page isn't in Norwegian. This is a UX question only.
The standard Norwegian date format is DD.MM.YYYY, _easily_ confused with MM/DD/YYYY. Why is it a feature to include this confusion?
[1]: This is pretty common, either deliberately or by accident. If you actually want to serve content localized in multiple ways (eg. you want to serve both an English and a Norwegian version) you have to sidestep browser localization anyway and offer the user a way to select which version they want.
Completely agree - that should not happen. Consistency is most important. So if a Norwegian user has an en-US browser and the rendering uses this control which uses default browser locale then all date rendering in all markup has to be en-US. That is: this control can't be used on a web site unless the site already uses browser locale for all date input and output.
If the web page already has custom date formatting (e.g. the user chooses locale/format in the site preferences) or if the page has elements rendererd DD.MM.YYYY already from the back end - then this control can't be used.
(Also: TIL Norway doesn't use ISO 8601 like Sweden. I honestly thought ISO 8601 was norm in Europe, but apparently mostly in Sweden).
According to [2]: "All members of CEN[3] (all of Western Europe and Scandinavia, and most of Eastern Europe) are required to adopt the EN 28601 European Standard. Most have now done so"
It's not obvious what this really means though.
[1] https://en.wikipedia.org/wiki/ISO_8601#Related_standards [2] http://www.qsl.net/g1smd/isoimp.htm [3] https://en.wikipedia.org/wiki/European_Committee_for_Standar...
That's the difference to sweden, we'd actually us an ISO 8601 type format as our everyday format.
I read web content in several languages and expect date formats in ALL applications my application to follow my OS locale which is Finnish.
My Windows operating system is in English, yet my locale is Finnish, so that the date format is Finnish. This is the standard way of using locales. Why would web sites be any different?
Firefox serves localized downloads by default, and you can also manually get the right one (IIRC it lets you override it on the download page)
This isn't configurable (yet; I'm trying to make it configurable), but you can download a localized release for en-GB and it should work.
I can change my OS locale settings just by opening up a panel. Firefox wants me to install a new official locale or a new browser bundle to do the same.
Btw, content language is not a locale preference, it's contextual. Browsers could have a standard dropdown in their UI to change that header on the fly, sure, but that wouldn't make language selection unnecessary. Take something like Wikipedia, the contents are widely different across languages, and switching is common for multilingual readers.
See also: "you can't fix the user".
Language preferences are a totally separate thing, although they could be used as a fallback if date format is somehow not offered by the operating system. E.g. de-CH for a swiss date format, de for a german date format.
Plus there are no way to distinguish month-day to day-month in a lot of cases
Edit: If you downvote it, be nice enough to let me know what you disagree with.
The issue is not about the possibility to have a weird format, the issue is that the format is automatically adjusted to the "weird" one that a lot of people don't like, and that it is not easily configurable.
I agree, though. Browsers allow users to customize fonts and zoom levels, so the date formats should probably be a user-configurable setting, too.
Can we agree that some webpages and webapps have already make the decision to control the locale through the app and not choose the environment default?
My OS and browser locale is pt-BR, but if for whatever reason I am not happy with a pt-BR UX, which is often, I want to be able to change it on a case by case basis.
For example, any documentation I look up, like say on MDN or AWS, I want to see it in english and not a poor/incomplete translation. If I play a Star Wars game on my browser or phone I do not want any translations, I want the original terms like scoundrel instead of the translator's choice of terms.
It is already bad enough as it is for the reasons I pointed out, now we are gonna have that same nightmare in forms as well?
Sure webapps that actually care will find a non standard way, as they already do, but then we are not actually improving when in 2017 you have to load 3rd party libs just to be able to choose the locale of a date input.
<input type=date> (environment default)
<input type=date locale="pt-BR"> (actual chosen locale)
Is that too much to ask?
<input type=date lang="pt-BR">
shall work.Like here: https://sciter.com/temp/date.png
I can't afford to give full support to all locales (translation costs are ridiculous), so detecting and supporting the user's locale seems to be pointless unless they happen to be using one of the limited set I can give full support to (en-CA and fr-CA in my case). It seems like a far better idea to allow the user of my website to choose one of the supported locales, and see everything in the same consistent format than to have a few input widgets on each page decide to configure themselves based on the locale the browser was compiled with.
Edit: also, consider testing. Am I supposed to download a bunch of variants of Firefox to test my locale support?
Even if your page isn't translated I would still want the dates to be localized. I understand English, but not the US time and date formatting.
So, to do what you want, I'd have to make different versions of all the supporting documentation for each possible date format, and then get each version translated.
Also, displaying the dates the user just entered in a different format is a usability problem. (Users will complain. A lot.) So, if I did what you want, I'd likely be asked to display all dates, everywhere on the site, in the format the browser happened to be compiled with. This is possible for dates in the database, but not so much for dates in static content like news releases.
Just to be clear: I have no objection to making it easy for a website to have date input widgets which use the user's locale. I just want it to be equally easy for a website to have date input widgets in a specific locale. For example, how am I to make a website comparing date input widgets for different locales?
??? I'd never said that I wanted a label explaining the date format for me.
> For example, how am I to make a website comparing date input widgets for different locales?
The input widgets return ISO 8601 regardless of the locale. Or what do you mean?
There is: new Date().toLocaleDateString()
I have my browser language set to Dutch but every time I touch Wikipedia or MDN I have to append "english" to my search terms to get a version of the article that isn't strictly inferior.
Manishearth, who's a Mozilla dev, commented in another thread that he's currently looking into making it configurable.
Same goes for the <select> input. The native one is usually always replaced by a custom designed one.
If every website used the same, it would be much more convenient than the current situation, where each date picker uses a subtly different mechanism to select the individual fields and then confirm the selected date. Most do not even support keyboard input.
All dates and times will be converted to ISO 8601 format, as specified in the spec, before being submitted to the web server.
Are you going to be appending a Z? Adding the browser's timezone? Adding T00:00:00Z to the dates? What? No clarity at all. You can't just hand wave and say 8601! 8601!
Also, we've had date and time pickers for over a decade now and this clearly doesn't meet the need.
It's such a shame that this is the standard they come out with.
The timezone is simply out of scope for this, and with good reason: Presumably the time a user enters will be interpreted in one of two ways:
* A javascript application running in the users browser, which already knows what the users current timezone is.
* An application running on a server somewhere, which will have the information of "a user submitted a time without a timezone", which is valuable information and very often that is exactly the correct way to interpret a time.
In the case very it's absolutely necessary to know the exact timezone a user wants to specify, it's very easy to add a widget to let a user specify the timezone. But I feel that's something that is much, much less common than letting a user set a simple time, so it makes sense to optimize for that.
The time picker has it's own problems, like the Oh, So Useful! seconds part. And that most people use drop-downs for this, but they say entering a time by hand is better (when it's not).
A lot of my client work at the moment is within the entertainment industry where obviously we need to pick times all the time. Both startups I work with use hour dropdown, [00, 15, 30, 45] minute drop down. One uses 24 h, one uses an AM/PM dropdown. You don't want people typing 12:07:03.
That time picker is not fit for purpose and I wouldn't be able to use it.
(Also, you don't seem to acknowledge this is a form control and you shouldn't need to use javascript to muck around with it before submitting it).
But then why are you complaining about the timezone ? A datepicker doesn't need a timezone.
Or are you under the impression that ISO 8601 requires a Time component?
In case you are, you are mistaken: ISO 8601 requires no Time. "2017-10-23" is perfectly valid according to ISO 8601 and it's also precisely what is submitted by the browser.
I don't really understand your comment about the specific allowed time format. It's obvious that every application will have different validation- requirements, that doesn't negate the usefulness of having a dedicated time input. Especially on mobile, getting a simple native time input widget seems like an advantage for many cases. If it doesn't work for your use-case then just don't use it. It exists to support, and if you already have a solution that is better, that's good, no?
EDIT-start I wrote this next part not realizing that the UI for the timepicker is not enabled in this version of Firefox, please ignore.
But just for completeness sake, you can let users enter increments of [00, 15, 30, 45] like this:
<input type="time" name="time" step="900" />
The value 900 comes from 15 times 60 seconds.
EDIT-endAs for your comment about my mention of javascript, I think you overread that I wasn't advocating "mucking around" I was merely pointing out the context of a serverless javascript application.
We're talking about a FORM control, a fundamental HTML technology that doesn't need JavaScript enabled. We're talking about specific implementation of a spec that they didn't spell out, skip over as if it didn't matter, and could alternately make the control brilliant or utterly useless.
And no, it's not good that they add an inflexible, broken, time control that you have to type and almost no-one will be able to use. Because now they won't try and make a decent one.
Yes! If they say that a date is to be in the ISO 8601 format, a reasonable person would assume that this means the ISO 8601 date format.
> or are they adding 00:00:00. Or worse 00:00:00Z. Or even worse 00:00:00+0700?
No! That would be the ISO 8601 datetime format! Why would you assume that they would use the datetime format for a date?
> They don't say!
If they said that dates are converted to RFC 2822 format, would you be griping about whether they were sending yyyy-MM-dd@hostname.tld? No, because it would be obvious from context that it means RFC 2822 date format, not RFC 2822 address format.
Maybe there is a little bit of potential for confusion, because they say "All dates and times will be converted ...", rather than making separate statements for dates and times. But when they say "as specified in the [spec](hyperlink-to-the-spec)" 4 words later, a reasonable person might head over to that spec to clear up any confusion or questions about the behavior.
> We're talking about specific implementation of a spec that they didn't spell out, skip over as if it didn't matter
The did spell out the spec! They included a direct hyperlink to the spec; that link was even in the part that you quoted. And since when is a blog post expected to spell out every little thing that is included in the spec that it's talking about? Especially when every third paragraph says "as specified in the spec" with a link to the relevant page in the spec?
No, but you can hand wave and say "as specified in the [HTML5] spec", with a link to the spec, and have the spec cover the details.
But really the answer is: ISO 8601 specifies standard formats for both datetimes (what you are referring to), and plain dates (YYYY-MM-DD). When an article says that a date is converted to ISO 8601 format, isn't it obvious that it means ISO 8601 date format, not ISO 8601 datetime format?
(Additionally, the spec doesn't say "8601 format", it specifies the format, and notes that it is "based on" 8601 format).
Given how this was setup in a nightly release they're very likely to start out "a little broken."
Really glad this is finally being added, I'm sure there's other features some of us wouldn't mind in HTML out of the box.
Update: Realized it's released on nightly not "Developer's" edition.
And a Mozilla dev, Manishearth, has commented above that he is in fact currently looking into making it configurable.
[1] https://www.mozilla.org/en-US/firefox/57.0beta/releasenotes/
Very thankful we’re starting to see this work roll out!
There was no point in time before now when this was the case...
If it falls back to default format, at least the default could little bit more universal/stanard, e.g. 'yyyy-mm-dd'.
Edit: Even after switching my preferred language from English to Finnish in browser settings, the format stays 'mm/dd/yyyy'. I'm using Finnish region in my OS settings as well.
Sorry, I'm not following you. Every application should use the format defined in OS settings, that's the point of the system setting, why should browser be an exception?
I use most if not all software in English, but I prefer seeing dates in the ISO format, weeks starting from Mondays and times in a 24 hour format.
Quite on the contrary! Wednesday is still in the middle of the working week, leaving the two day weekend kind of as a special separate thing. :)
Great to see it here! I hope it spreads to other browsers quickly.
It is in other browsers for years
data:text/html, [Your HTML here]
data:text/html;base64,[Your base64 encoded HTML here]
data:image/png;base64,[Your image data here]
The latter is extremely common for embedding static resources directly into HTML pages. To the point there JS APIs the form obj.toDataURL()[0]
[0] https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasE...
What's the benefit of this? I get that it reduces the number of HTTP requests, but it also fails to cache the resources, so you're betting on the client never requesting that image again (and the client may be a proxy server, right?). It also makes a right mess of your markup, if that's something you care about.
Apart from Xophmeister's point about embedding within a cached resources, two other use-cases:
1. generated or dynamic resources - e.g. displaying an image from a file input before it's uploaded to a server
2. reliability - e.g. Github's 404 page[0] uses them to ensure the entire page source is standalone and works independently of other services/resources.
E.g. I use url-loader in webpack to do require('./some_image.png') and that's converted to a data URI if the image is small enough (otherwise I get a regular URI). The output is a .js file shared among all pages of the site.
var el = document.createElement("input");
el.type = "time";
var supported = (el.type == "time");
If only there wasn't a bug on firefox mobile that would return "text" even if the input field type is supported.... mhmmm webdevelopment...
Since I recently tried to implement a date input and was shocked to discover that Firefox didn't support it, despite being in 'their' docs. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/in...
In your case:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/in...
And I'm also pretty sure they've already been actively working on the implementation prior to talks with those companies. I think, I remember reading about first design steps at the start of the year already.
Seems incoherent to use US date format for the box and ISO8601 format for the error message.
Also I wish software in general would stop trying to guess what the locale settings should be and just ask. I have my language set as en_US but I prefer to use 24h time and ISO8601 dates. With this update Firefox guesses wrongly 12h time and mm/dd/yyyy date format with no way to override it that I could find.
I've thought this so many times, even on my phone where typing is less accessible, I still prefer it over those analogue clock face inputs.
With such a clock input, I'll often hit the wrong time, either an hour/minute too late/early, due to my apparently fat fingers, or 12 hours wrong, because I live in a 24-hour-format region where normally on an analogue clock you read things in 12-hour-format and so my brain thinks "8 pm" and enters "8" when it should have chosen "20". That doesn't happen with typing, because digital clocks almost always display 24-hour-format.
And even worse, in an attempt to speed things up, someone came up with the ingenious idea of directly advancing from hour input to minute input as soon as some input has been made. So, my first few wrong inputs then mean that I have to find the way to get back to the hour selection multiple times.
Especially given how hard it is to implement dates and calendars correctly.
Businesses have the hubris of designing their own custom UIs for everything, deeply tainted with their branding, and they all end up reinventing the wheel because standard solutions aren't compatible with their designs.
It's time to dissociate software from branding, so we can free 90% of developers and have them do something useful for once.
And how should we do that? Isn't that what CSS tried to do (but failed)?
Perhaps we should invent a different title for programmers that do relatively simple work, like writing CSS and perhaps some easy javascript. That way, the real programmers can more easily say "that's not in my job description".
I want all apps to look and behave the same, to the point where they're all just one app.
Nobody asked for their shopping experience to be different when shopping on Amazon vs eBay vs Craigslist. I see no compelling reason to have different UI for services that are essentially identical.
What if one browser does something others won't, and you can't do it custom, how do you get around it? Wouldn't that put us back to IE6 web?
What if your site really needs something browsers don't have? Will we have sites telling us to install a plugin and put us back to Flash era?
Custom things will be done through a canvas, but that should only be used in last resort.
Or do you want to enforce it somehow?
For your example, you would just need a step with some kind of range. So you could say step=7, range=5 to allow them to pick from the first 5 days of every 7 (or to get trick step=7 range=-2 to eliminate the last 2 days). I'd hazard a guess they thought about this kind of stuff, but realised it would be complicated pretty quickly.
And it doesn't have range, does it? So the infinitely more useful range hasn't been specified, but the almost useless step has.
Good news in any case! The back office tool I work on is Chrome only and it's been great to just use type="date"!
It's basically just making an <input>, setting its @type and seeing if that sticks, then setting a known-invalid value and seeing if that sticks.
For <input type="time"> it's <https://html.spec.whatwg.org/multipage/common-microsyntaxes..... Again, to translate to something readable, it's HH:MM[:SS] where the :SS part is optional if seconds is 0, and all numbers are 0-based (so 0 <= HH <= 23, 0 <= MM,SS <= 59).
For <input type="datetime-local"> it's https://html.spec.whatwg.org/multipage/common-microsyntaxes.... which is yyyy-mm-ddThh:mm[:ss] without any timezone information, afaict, and with [:ss] guaranteed to be left out if 0.
E.g. if I'm booking a hotel you don't want it to pick up the user's timezone and frob that into UTC to send it over; you want the local hotel timezone. But if you're setting a calendar event you do want the timezone to be configurable, and you can add a picker for that.
Assuming all time fields must have a timezone is why e.g. jekyll will re-date your prior posts (breaking all URL slugs) when you change your timezone.
I suppose. In the product I'm current working, I guess technically we could add a TZ dropdown as you describe, but it'd go unused because the kind of events our users schedule, they want to use their current corporate local time always (there's no travelling across timezones involved for our users), and we need to know what time that is over here, so in lieu of one useful form field (UTC or datetime offset), we'd now have to send two (change the dropdown to a type=hidden), or another one with a "proper" datetime string. I guess not the end of the world[1], but it does introduce more opportunities for bugs.
From what I've seen, few products have that timezone dropdown, and usually it tends to be an override that still needs a sensible fallback, and no information as to what timezone the current user is in gives you absolutely nothing.
DateTime offset lets the application handle most cases, so that's what I prefer to use.
[1]: also needs a timezone
I wasted about 2 minutes trying to figure out how to input seconds in the embedded example. Turns out it was am/pm. Maybe the picker can be a simple drop-down list.
I think you can enable the time picker by toggling dom.forms.datetime.timepicker on. It's on for me, but it isn't the default.
But will the inputs be mixed-reality ready?