nswdpc/silverstripe-datetime-inputs

Date and Datetime composite inputs for Silverstripe framework

Installs: 1 900

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

v1.0.0-rc1 2023-05-26 03:01 UTC

This package is auto-updated.

Last update: 2024-04-14 02:08:05 UTC


README

Collect a date or datetime input via single composite field made up of relevant day, month, year and time inputs. The parent field is a standard composite field with child fields submitting data within the form submission for validation.

Child input fields are standard numeric inputs. The time field is a time input.

All child fields are accessible via keyboard navigation.

Installation

composer require nswdpc/silverstripe-datetime-inputs

Usage

$dateValue = "2028-01-30";

// Date only
$field = DateCompositeField::create(
    'EventDate',
    _t(
        'app.EVENT_DATE',
        'Date of the event'
    ),
    $dateValue
)->setDescription(
    _t(
        'app.EVENT_DATE_TIME_DESCRIPTION',
        'Provide the date of the event'
    )
);

// Date and Time
$datetimeValue = "2028-01-30 11:45";

$field = DatetimeCompositeField::create(
    'EventDateTime',
    _t(
        'app.EVENT_DATE_TIME',
        'Date and time of the event'
    ),
    $datetimeValue
)->setDescription(
    _t(
        'app.EVENT_DATE_TIME_DESCRIPTION',
        'Provide the date and time of the event'
    )
);

Further documentation

License

BSD-3-Clause

Maintainers

Bugtracker

We welcome bug reports, pull requests and feature requests on the Github Issue tracker for this project.

Please review the code of conduct prior to opening a new issue.

Security

If you have found a security issue with this module, please email digital[@]dpc.nsw.gov.au in the first instance, detailing your findings.

Development and contribution

If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers.

Please review the code of conduct prior to completing a pull request.