FRDW - Dates submitted are lost after submit.

Created on 3 February 2022, almost 3 years ago
Updated 20 September 2023, about 1 year ago

dates submitted do not become 'value' after item is submitted.
as timestamp in URL is epoch, user can not ever understand what they submitted. This is another type of concern, but to mention.

3257154#6. POC. note: dateTimezone UTC from JS.

    // Find if User is using this input, get Value for post load.
    $defaultTime = FALSE;
    $facetParam = \Drupal::request()->query->get('f');
    $matches = [];
    if (!empty($facetParam)) {
      foreach ($facetParam as $k => $v) {
        preg_match('/\(min:((?:-)?[\d\.]+)/i', $v, $matches);
      }
    }
    // Greater than 2 (is a useful time, not negitive, 1 false bool)
    if (isset($matches[1]) && is_numeric($matches[1]) && strlen($matches[1]) == 10 && (int) $matches[1] > 2) {
      $defaultTime = $matches[1];
    }
    if ($defaultTime !== FALSE) {
     $dateTimezone = DrupalDateTime::createFromTimestamp( (int)$defaultTime,  new \DateTimeZone('UTC') );
     $date = $dateTimezone->format('Y-m-d');
     $build['#items']['min']['input']['#attributes']['value'] = $date;
    }
🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇨🇦Canada SKAUGHT

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024