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

Migrate or implement formatters from official datetime skill #198

Open
ChanceNCounter opened this issue Jun 8, 2021 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@ChanceNCounter
Copy link
Contributor

The official DateTime Skill currently contains some nifty get_x() functions for relevant information, most of which just expose things from Lingua Franca. Others retrieve info from LF and then mutate it a bit. Clever little formatters.

These are very useful to other Skills, and not only Skills! I became aware of them because @AIIX used them for home screen info. Anything that wants to display the date or a schedule could benefit, so I think LF should support that stuff directly. We're halfway there already with nice_time().

We could start by simply migrating the functions from the Skill and seeing if anything even needs further localization. At a glance, it looks like it's built around lingua_franca.format.date_time_format.

@chrisveilleux thoughts from the Skill side of things?

@krisgesling
Copy link
Contributor

Yeah this seems like a good thing to pull out, I can imagine many things wanting to have a nice looking day / date / month and whilst the Skills API is great, these would be broadly used including outside Mycroft.

Would the following cover everything?

  • nice_display_date (distinguished from the current nice_date_time() which provides a pronounceable date)
  • nice_month
  • nice_weekday

Given nice_day and nice_year would both be wrapping a single .strftime() call it doesn't seem necessary to add these.
And I would see the lingua_nostra.format.nice_day(dt, include_month=True) being covered by nice_display_date()

In nice_display_date(), should we take in a format that matches either strftime, "DMY", or "MDY"?

I can see the leap year stuff fitting into the current time.py however for me it also doesn't seem to fit into the scope of Lingua Franca as a formatting and parsing library. We could add it to mycroft.util.time but I can't imagine it getting used a lot. Maybe this is one that makes sense being in the Skill and exposed via the Skill API.

@chrisveilleux
Copy link
Member

I will be looking at the date/time skill next week to give it some much needed TLC. Once I've had a chance to familiarize myself with the skill again I will provide some feedback.

JarbasAl added a commit to OpenVoiceOS/ovos-lingua-franca that referenced this issue Nov 27, 2022
JarbasAl added a commit to OpenVoiceOS/ovos-lingua-franca that referenced this issue Feb 14, 2023
* feat/nice_date utils

MycroftAI#198

* @localized_function(run_own_code_on=[FunctionNotLocalizedError])

* MDY/DMY/YMD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants