2017 © Pedro Peláez
 

silverstripe-module silverstripe-localdatetime

Localized Date, Time & Date-Time fields for SilverStripe

image

et-innovations/silverstripe-localdatetime

Localized Date, Time & Date-Time fields for SilverStripe

  • Thursday, August 17, 2017
  • by et-innovations
  • Repository
  • 3 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

silverstripe-localdatetime

Translatable fieldtypes for:, (*1)

  • Date
  • Time
  • DateTime

Maintainer Contact

Requirements

  • SilverStripe 3.0

Installation

Install via composer composer require et-innovations/silverstripe-localdatetime or extract the contents of this repository into the root-folder of your project., (*2)

Usage Overview

Simply create the wished field in the array $db:, (*3)

class MyDataObject extends DataObject {

    public static $db = array(
        'SomeDateField' => "LocalDate",
        'SomeTimeField' => "LocalTime",
        'SomeDateTimeField' => "LocalDatetime",
    );

}

To get translated value in GridField, you need to declare a function with the same name as the field and return the value as wished:, (*4)

class MyDataObject extends DataObject {

    ...

    public function SomeDateField() {
        if($this->{__FUNCTION__})
            return DBField::create_field('LocalDate', $this->{__FUNCTION__})->Nice();
    }

}

The Versions

17/08 2017

dev-master

9999999-dev http://et-innovations.org

Localized Date, Time & Date-Time fields for SilverStripe

  Sources   Download

MIT

The Requires

 

The Development Requires

date time locale silverstripe i18n datetime local

01/09 2015

dev-wip/i18n-overwrites

dev-wip/i18n-overwrites

LocalDateTime translates date and time strings to the current locale set by i18n::set_locale(). The strings themselves are formatted then via Zend-Date.

  Sources   Download

The Requires

 

date translation time silverstripe i18n translatable datetimefield datefield timefield localdate