Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Setup Device Preferences Missing YYYY-MM-DD Date Format #2933

Closed
firebladed opened this issue Jun 26, 2021 · 5 comments
Closed

Setup Device Preferences Missing YYYY-MM-DD Date Format #2933

firebladed opened this issue Jun 26, 2021 · 5 comments
Labels
Type: Enhancement - proposed New proposal for a feature that is not currently a priority on the roadmap.

Comments

@firebladed
Copy link

Is your feature request related to a problem? Please describe.
Missing YYYY-MM-DD Date Format on https://account.mycroft.ai/devices/add

Describe the solution you'd like
add YYYY-MM-DD Date Format option
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
variants of YMD used internationally and is part of ISO 8601 standard (https://www.iso.org/standard/70907.html)

@krisgesling krisgesling added the Type: Enhancement - proposed New proposal for a feature that is not currently a priority on the roadmap. label Jul 9, 2021
@krisgesling
Copy link
Contributor

Hey there,

I'm curious where you were expecting the YMD format to be used or if your preference is for that to be used everywhere?

Take the Mark II Homescreen display as an example
screen-102829-140621

If you selected YYYY-MM-DD, would you expect the date here to show:

  • "2021-07-09"
  • "2021 July 09"
  • "Friday July 09"
  • or something else?

A challenge in making this change will be hunting down how this config value is used currently, not just in core but elsewhere. Even though it's a string, it has so far been presented as a binary option - [DMY, MDY]
So from memory there are many instances of

if format == "DMY":
  ...
else:
  ...

@firebladed
Copy link
Author

i think technically that format isn't YMD, MYD or DMY the presence of weekday and the lack of a year complicates things

think technically its "dddd mmm dd"

firstly i personally prefer unambiguous date formats

for English usage of written YMD doesn't seem to have a defined "long" format

generally its just the [YYYY]-[MM]-[DD] format, but could also include a weekday but don't think there is any standard for that

both "2021-07-09" or "2021 July 09" seem possibilities short, medium format respectively?

the only country ive found so far that uses a consistent YMD full or long form is lithuania (lt_LT)

e.g 2008 m. vasario 5 d., antradienis (full)
2008 m. vasario 5 d. (long)
(2008 feburary 5 tuesday)

secondly if reviewing dates in general there are other complications for other languages/countries e.g

for Japanese, and i think china, there is only YMD format

2021年7月9日 , they are also usually spoken that way, also there is an optional weekday

e.g 2021年7月9日金曜日

in Japanese there is no "july" only 7月 (しちがつ)(shichigatsu) literally 7th month

so you basically have 2021/07/09 or 2021年7月9日 with the option for weekday

personally i would replace if... else date code with a utility function that formats based upon language and selected date format

e.g format_date(lang_code,endian,length,options)

in the mycroft core

if not obvious

    B – big-endian (year, month, day), e.g. 2016-04-22 or 2016.04.22 or 2016/04/22 or 2016 April 22
    L – little-endian (day, month, year), e.g. 22.04.2016 22-04-2016 or 22 April 2016
    M – middle-endian (month, day, year), e.g. 04/22/2016 or April 22, 2016

and use a table of available formats see wikipedia for an example

so could have something like

lang_code big_endian_long big_endian_short middle_endian_long middle_endian_short little_endian_long little_endian_short
en ? YYYY-MM-DD dddd mmm dd YYYY MM-DD-YY dddd dd mmm yyyy DD-MM-YY
jp YYYYYMMM-DDD YYYY/MM/DD

in the above "YYYYY" the extra Y signifies the year counter"年"
the extra M and the extra D signify the month(月) and day(日) counters especially

im not familiar with what preexisting python modules exist for international date formatting a brief search found dateparser but don't know what else exists

something like DateTime-Locale may be useful

Time formatting may also show up at some point so might be wise to create a utility function for that as well

both the 24 hour vs 12 hour clock

English AM PM
Japanese 午前 午後 except in Japanese the AM/PM goes before the time e.g 午前0時15分 (12:15 AM)

i believe Chinese is similar to Japanese but not identical 上午(AM) 下午(PM)

and counters for hours,mins,seconds

Chinese/Japanese 19時45分45秒

both Chinese and Japanese use the same characters, but they are read differently [19 Shí 45 fēn 45 miǎo][19-Ji 45-bu 45-byō] respectively if I'm remembering the readings right

im not sure if/how this would tie in with Lingua Franca's datetime functionality, as wouldn't want unnecessary duplication

I might be able to put some time into helping with this i if wanted, i can probably help with replacing if.. else with a utility function if that's decided as being the way to approach this.

i probably need to think about/research this more

@krisgesling
Copy link
Contributor

Thanks @firebladed - so much useful detail there.

I think the plan is for this to really live in Lingua Franca. As you say we don't want to duplicate and some of this already exists there, it just hasn't been intentionally exposed as a use case previously.

I had a quick look but couldn't find if it was actively being worked on right now. @ChanceNCounter might be able to point us in the right direction?

@ChanceNCounter
Copy link
Contributor

The lingua_franca.config branch that's semi-active will expose things like the date formats on offer, but it relies on whatever's importing it to set config values at runtime. In this case, that's presumably still mycroft.conf or other Mycroft config files.

For languages where they're implemented, available date and DT formats are currently represented as regex in lingua_franca/res/text/<locale>/date_time.json

Adding different DT formats should be as "easy" (straightforward) as adding elements in there. The toughest part would be coming up with the regex. I'd also like to spin those off into common files for a particular language (at least) but that's another thing entirely.

As for exposing it, that'd be MycroftAI/lingua-franca#185 (and corresponding issue 128)

@forslund
Copy link
Collaborator

forslund commented Sep 8, 2024

Closing Issue since we're archiving the repo

@forslund forslund closed this as completed Sep 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Enhancement - proposed New proposal for a feature that is not currently a priority on the roadmap.
Projects
None yet
Development

No branches or pull requests

4 participants