forecastie icon indicating copy to clipboard operation
forecastie copied to clipboard

Provide explanations on available formatting strings for custom date/time format

Open Porkepix opened this issue 4 years ago • 13 comments

Currently it's possible to set a custom date/time format, but there's not hint as to which formatter to use for it. Some hints as to which formatting strings are used would be quite nice for the user.

Porkepix avatar Feb 02 '20 11:02 Porkepix

I think it's something called "Simple date format", a search on the web will find it. That said, we should perhaps give a better idea of how to use it. Here's some docs, written for programmers, not end users: https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

robinpaulson avatar Feb 02 '20 12:02 robinpaulson

I recall we talked about this previously. Offering freeform examples is good... up to a point. Maybe we only offer a fixed set of formats, the user can then choose one.

robinpaulson avatar Feb 02 '20 12:02 robinpaulson

Problem with this is that you can't satisfy anyone with completely set proposals, or you allow to pick separately setting for different elements, eg. separators, number order for date and order between day, date and time.

For example my chosen format would be dd/mm/yyyy hh:mm which isn't covered by the presets. And other people would do different choices.

Porkepix avatar Feb 02 '20 12:02 Porkepix

There are a few bugs related to this: #326 #287 #219 #272 #361

robinpaulson avatar Feb 02 '20 12:02 robinpaulson

And other people would do different choices.

At some point, the code to support those choices becomes more complicated than I think is necessary. Sure, this is to a certain extent arbitrary, but it is a relatively minor setting.

As was pointed out in one of the bugs I listed above, there are likely libraries for this, are you prepared to put time into coding something?

robinpaulson avatar Feb 02 '20 12:02 robinpaulson

As was pointed out in one of the bugs I listed above, there are likely libraries for this, are you prepared to put time into coding something?

Sadly my skills are more about taking care of servers than code itself, and about code especially not Java :/

Porkepix avatar Feb 02 '20 12:02 Porkepix

I have seen a few places where they have a tiny legend which helps me experiment with the choices. It may show all potiential characters, a combination of common choices, and then what it represents. That's enough for me to figure out what I want.

If the popup included these 3 lines (or at least the first line) it would give me enough of a "decoder" to figure out what I can do

GyYMwWDdFEuaHkKhmsSzZX

EEEE, d MMM yyyy h:mm:ss a, zzzz

Wednesday, 4 Jul 2001 12:08:32 PM, Pacific Daylight Time

it shows you variations between shorthand and longhand, i.e. how four E's spelled out the day of the week, while three M's spelled out an abbreviated variation of the month - which might imply they could each handle three and four character variations.

jawz101 avatar Feb 03 '20 18:02 jawz101

it would give me enough of a "decoder" to figure out what I can do

True, it would. It likely looks intimidating and overwhelming to most users though, I'm not keen on putting things like that in the main interface, I'd prefer them at least behind a button or an "Advanced" tab.

robinpaulson avatar Feb 05 '20 12:02 robinpaulson

Oh, definitely. Like in the popup

jawz101 avatar Feb 05 '20 15:02 jawz101

OK, let's do as you suggest. I'd like a title/introduction for the popup though - nothing complicated, something to give a clue what the text does. Here's a suggestion: "The codes below can be used to construct a custom date and time format"

robinpaulson avatar Feb 06 '20 00:02 robinpaulson

We'll need to add some more strings to make this work; can you give me some suggestions as to how to name the strings you posted in your message from Feb 3rd? These: yYMwWDdFEuaHkKhmsSzZX

EEEE, d MMM yyyy h:mm:ss a, zzzz

Wednesday, 4 Jul 2001 12:08:32 PM, Pacific Daylight Time

robinpaulson avatar Mar 19 '20 04:03 robinpaulson

I think these cover it, I'll add them to strings.xml later today

simple_string_formatting_intro available_simple_string_codes example_simple_string example_date_format

I'll need someone else to code the popup though.

robinpaulson avatar Mar 19 '20 06:03 robinpaulson

Oh, definitely. Like in the popup

I've just realised: the only way a user will see the codes is if they have (a) selected custom codes and (b) clicked the button to enter a custom code. It's probably overkill to then put the codes in another dialogue, so I'm going to put them directly in the "Enter custom code" dialogue, not behind another button.

robinpaulson avatar Mar 19 '20 08:03 robinpaulson