question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

time format for JSON output

See original GitHub issue

hello,

when i use german language for JSON output, the time format is still in a format with AM and PM but in german or europe it is pretty uncommon to use that format, i expect a 24H format for time.

e.g.:

$ curl de.wttr.in/Berlin?format=j1
{
    "current_condition": [
        {
            "FeelsLikeC": "10",
            "FeelsLikeF": "50",
            "cloudcover": "0",
            "humidity": "76",
            "lang_de": [
                {
                    "value": "Regen"
                }
            ],
            "localObsDateTime": "2022-09-28 11:40 AM",
            "observation_time": "09:40 AM",
...
        {
            "astronomy": [
                {
                    "moon_illumination": "15",
                    "moon_phase": "Waxing Crescent",
                    "moonrise": "09:57 AM",
                    "moonset": "07:48 PM",
                    "sunrise": "07:02 AM",
                    "sunset": "06:51 PM"
                }
...

i would expect this format:

            "localObsDateTime": "2022-09-28 11:40",
            "observation_time": "09:40",
...
                    "moonrise": "09:57",
                    "moonset": "19:48",
                    "sunrise": "07:02",
                    "sunset": "18:51"
...

or is ther another way to select the time format?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
beta-testercommented, Oct 3, 2022

to have an option to choose between 12Hr and 24Hr time format would be nice.

0reactions
chubincommented, Oct 22, 2022

It is a good feature request. Accepted.

Should we make it configurable only with the time format parameter? Probably, the same parameter should be used in the one-line output format and everywhere else.

Also, we could make the date/time format fully configurable from outside (not only AM/PM, but just pass the format string).

If you would like to contribute, feel free to do it. The feature should be added here:

https://github.com/chubin/wttr.in/blob/master/lib/view/line.py#L388

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the "right" JSON date format? - Stack Overflow
There is no date format in JSON, there's only strings a de-/serializer decides to map to date values. – user395760. Apr 23, 2012...
Read more >
The “right” JSON Date Format - W3docs
To represent dates in JavaScript, JSON uses ISO 8601 string format to encode dates as a string. Dates are encoded as ISO 8601...
Read more >
[MS-ES3EX]: Date Time String Format for JSON | Microsoft Learn
2.4.6 Date Time String Format for JSON. Article; 10/12/2020; 2 minutes to read.
Read more >
Rest Controller — Configure Date & Time Format in JSON ...
In this article, we have learned how to configure LocalDate, LocalTime and LocalDateTime format pattern in JSON response for @RestController at ...
Read more >
JavaScript JSON Date Parsing and real Dates - Rick Strahl
The problem with dates in JSON – and really JavaScript in general – is that JavaScript doesn't have a date literal. You can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found