2017 © Pedro Peláez
 

silverstripe-module silverstripe-timezones

Provides time zone data as well as a pre-populated dropdown field for SilverStripe

image

spekulatius/silverstripe-timezones

Provides time zone data as well as a pre-populated dropdown field for SilverStripe

  • Friday, April 20, 2018
  • by spekulatius
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,790 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 8 Versions
  • 10 % Grown

The README.md

SilverStripe Time zones FormField module

Build Status Latest Stable Version Latest Unstable Version Scrutinizer Code Quality Total Downloads License, (*1)

Provides a reusable model and data of the time zones worldwide. In addition a dropdown field for a time zones selection is included., (*2)

Requirements

  • SilverStripe Framework 4.0

Installation

For the installation you can either download the package, unzip it into your project directory and run dev build manually or run the following commands in your project directory:, (*3)

composer require spekulatius/silverstripe-timezones
./vendor/bin/sake dev/build

The data will automatically populated on dev build., (*4)

Provided Data

The provided data comes from PHPs built-in function timezone_identifiers_list(). Before the data gets saved in the db it will be prepared so its ready to be used., (*5)

If you want to use the dropdown field you can simply add a timezone to your db fields:, (*6)

<?php
use Spekulatius\TimeZones\Model\FieldType\TimeZone;
use Spekulatius\TimeZones\Forms\TimeZoneField;

class MyPage extends Page
{
    /**
     * @var array
     */
    private static $db = array(
        'UserTimeZone' => TimeZone::class
    );

    /**
     * @return FieldList
     */
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        // ...

        $fields->addFieldToTab(
            'Root.Main',
            TimeZoneField::create(
                'TimeZone',
                'My time zone'
            )
        );

        return $fields;
    }
}

Format of time zone

You can change the default format of the time zone in the dropdown menu by creating a file mysite/_config/timezone.yml and adding e.g., (*7)

SilverStripe\Core\Injector\Injector:
  Spekulatius\TimeZones\Model\TimeZoneData:
    properties:
      format: '%Name (%Region)'

You can use 'Name', 'Region' and 'Identifier' in the string and it will be replaced proper., (*8)

* [Future ideas/development, issues](https://github.com/spekulat/silverstripe-timezones/issues),
* [Contributing](https://github.com/spekulat/silverstripe-timezones/blob/master/CONTRIBUTING.md),
* [License](https://github.com/spekulat/silverstripe-timezones/blob/master/license.md)

This project is supported by bring your own ideas Ltd.. Bring Your Own Ideas Ltd. helps you to make your project ideas a reality., (*9)

bring your own ideas, (*10)

The Versions

20/04 2018

dev-master

9999999-dev https://github.com/spekulatius/silverstripe-timezones

Provides time zone data as well as a pre-populated dropdown field for SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

dropdown silverstripe data time zone time zones

20/04 2018

0.3.4

0.3.4.0 https://github.com/spekulatius/silverstripe-timezones

Provides time zone data as well as a pre-populated dropdown field for SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

dropdown silverstripe data time zone time zones

09/07 2016

0.3.3

0.3.3.0 https://github.com/spekulatius/silverstripe-timezones

Provides time zone data as well as a pre-populated dropdown field for SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

dropdown silverstripe data time zone time zones

16/04 2016

0.3.2

0.3.2.0 https://github.com/spekulatius/silverstripe-timezones

Provides time zone data as well as a pre-populated dropdown field for SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

dropdown silverstripe data time zone time zones

14/02 2016

0.3.1

0.3.1.0 https://github.com/spekulatius/silverstripe-timezones

Provides time zone data as well as a pre-populated dropdown field for SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

dropdown silverstripe data time zone time zones

13/12 2015

0.3.0

0.3.0.0

Provides time zone data as well as a pre-populated dropdown field for SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

dropdown silverstripe data time zone time zones

03/10 2015

0.2.0

0.2.0.0

Provides time zone data as well as a pre-populated dropdown field for SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

dropdown silverstripe data time zone time zones

06/07 2015

0.1.0

0.1.0.0

Provides time zone data as well as a pre-populated dropdown field for SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

dropdown silverstripe data time zone time zones