NAME

Wikibase::Datatype::Value::Time - Wikibase time value datatype.

SYNOPSIS

use Wikibase::Datatype::Value::Time;

my $obj = Wikibase::Datatype::Value::Time->new(%params);
my $after = $obj->after;
my $before = $obj->before;
my $calendarmodel = $obj->calendarmodel;
my $precision = $obj->precision;
my $timezone = $obj->timezone;
my $type = $obj->type;
my $value = $obj->value;

DESCRIPTION

This datatype is item class for representation of time.

METHODS

new

my $obj = Wikibase::Datatype::Value::Time->new(%params);

Constructor.

Returns instance of object.

  • after

    After. Default value is 0.

  • before

    Before. Default value is 0.

  • calendarmodel

    Calendar model. Default value is 'Q1985727' (proleptic Gregorian calendar).

  • precision

    Time precision. Default value is 11.

  • timezone

    Time zone. Default value is 0.

  • value

    Time value. Parameter is required.

after

my $after = $obj->after;

Get after.

Returns number.

before

my $before = $obj->before;

Get before.

Returns number.

calendarmodel

my $calendarmodel = $obj->calendarmodel;

Get calendar model. Unit is entity (e.g. /^Q\d+$/).

Returns string.

precision

my $precision = $obj->precision;

Get precision.

Returns number.

timezone

my $timezone = $obj->timezone;

Get time zone.

Returns number.

type

my $type = $obj->type;

Get type. This is constant 'time'.

Returns string.

value

my $value = $obj->value;

Get value.

Returns string.

ERRORS

new():
        From Wikibase::Datatype::Utils::check_datetime():
                Parameter '%s' has bad date time.
                        Value: %s
                Parameter '%s' has bad date time day value.
                        Value: %s
                Parameter '%s' has bad date time hour value.
                        Value: %s
                Parameter '%s' has bad date time minute value.
                        Value: %s
                Parameter '%s' has bad date time month value.
                        Value: %s
                Parameter '%s' has bad date time second value.
                        Value: %s
        From Wikibase::Datatype::Utils::check_entity():
                Parameter 'calendarmodel' must begin with 'Q' and number after it.
        From Wikibase::Datatype::Value::new():
                Parameter 'value' is required.

EXAMPLE

use strict;
use warnings;

use Wikibase::Datatype::Value::Time;

# Object.
my $obj = Wikibase::Datatype::Value::Time->new(
        'precision' => 10,
        'value' => '+2020-09-01T00:00:00Z',
);

# Get calendar model.
my $calendarmodel = $obj->calendarmodel;

# Get precision.
my $precision = $obj->precision;

# Get type.
my $type = $obj->type;

# Get value.
my $value = $obj->value;

# Print out.
print "Calendar model: $calendarmodel\n";
print "Precision: $precision\n";
print "Type: $type\n";
print "Value: $value\n";

# Output:
# Calendar model: Q1985727
# Precision: 10
# Type: time
# Value: +2020-09-01T00:00:00Z

DEPENDENCIES

Error::Pure, Mo, Wikibase::Datatype::Utils, Wikibase::Datatype::Value.

SEE ALSO

Wikibase::Datatype::Value

Wikibase datatypes.

REPOSITORY

https://github.com/michal-josef-spacek/Wikibase-Datatype

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2020-2024 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.34