Skip to content

RFC: date-time builtin type #5122

Open
Open
@WilstonOreo

Description

@WilstonOreo

When you build Calendars and other Date/Time-Widgets, properties with a date-time builtin type might be useful.
Here are a few suggestions how a builtin type date-time could look like:

component Calendar {
in property <date-time> date-time;
}

date-time should behave similar to a JavaScript Date object with convenience functions:

  • hours() -> int, minutes() -> int, month_name() -> string
  • to_string(format: string) -> string: date-time.to_string("DD/MM/YYYY"), date-time.to_string("hh:mm:ss")
  • to_locale_string(locale: string) -> string:

Additionally, there could also be a DateTime namespace to hold functions to construct date-time instances:

  • DateTime.now()
  • DateTime.new(year: int, month: int, day: int, hours: int, minutes: int, seconds: int)

Comments/Suggestions welcome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    rfcRequest for comments: proposals for changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions