govuk-prototype-kit icon indicating copy to clipboard operation
govuk-prototype-kit copied to clipboard

Users find it hard to work with dates

Open joelanman opened this issue 3 years ago • 4 comments

What

The ability to show todays date, or to manipulate and format dates (for example a date 30 days from today, formatted in the GOV.UK style for dates)

Should this feature support different types of date format? Or just the GOV.UK style? What would the MVP be? Today's date? Could this be a GOV.UK date plugin?

This is a time boxed spike Initially a day would be spent investigating possible solutions. If more time is needed, it must be discussed and agreed first before work continues.

Why

Because this is something users struggle with and it comes up fairly regularly in support.

Who

  • Developer
  • Designer

Done when

  • [ ] Possible solutions are shown to the team
  • [ ] The next step(s) are identified
  • [ ] New ticket(s) are created

joelanman avatar Oct 29 '21 10:10 joelanman

We've got lots of filters for working with dates - happy to contribute. Current versions are here - though they're currently using Moment and I know you'd prefer a supported library. Any preference on library?

Some of the common things I use filters for:

Formatting dates in GOV.UK style

Convert a javascript date to string 2021-05-28T17:21:36.307Z to 28 May 2021

Convert an array of integers to string (as produced by govukDateInput) [1,2,2020] to 1 February 2020

Converting dates to arrays of integers

Useful where you want to populate a govukDateInput with an existing date 28 May 2021 to [28,5,2021

General purpose checks

isInFuture isInPast isInLast(x, period) - check if date is within x period

edwardhorsford avatar Nov 03 '21 15:11 edwardhorsford

Just to note this has come up regularly in support recently

joelanman avatar Aug 05 '22 09:08 joelanman

there are some date filters in the X-GOVUK filter plugin: https://x-govuk.github.io/govuk-prototype-filters/date/

joelanman avatar Aug 31 '23 12:08 joelanman

https://github.com/alphagov/govuk-prototype-kit-docs/pull/266

oli-rose28 avatar Sep 25 '23 11:09 oli-rose28