LaravelPackages.net
Acme Inc.
Toggle sidebar
et-innovations/silverstripe-localdatetime

Localized Date, Time & Date-Time fields for SilverStripe

15
0
About et-innovations/silverstripe-localdatetime

et-innovations/silverstripe-localdatetime is a Laravel package for localized date, time & date-time fields for silverstripe. It currently has 0 GitHub stars and 15 downloads on Packagist. Install it with composer require et-innovations/silverstripe-localdatetime. Discover more Laravel packages by et-innovations or browse all Laravel packages to compare alternatives.

Last updated

silverstripe-localdatetime

Translatable fieldtypes for:

  • 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.

Usage Overview

Simply create the wished field in the array $db:

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:

class MyDataObject extends DataObject {
	
	...
	
	public function SomeDateField() {
		if($this->{__FUNCTION__})
			return DBField::create_field('LocalDate', $this->{__FUNCTION__})->Nice();
	}
	
}
Comments