NAME

SIRTX::Datecode - module for interacting with SIRTX Datecodes

VERSION

version v0.01

SYNOPSIS

use SIRTX::Datecode;

This module provides support to convert between different date formats and SIRTX datecodes. SIRTX datecodes allow to encode dates in the range of years 1582 to 2440 into just 16 bits by using a variable precision. They also allow for numeric ordering over their full range.

This package inherits from Data::Identifier::Interface::Userdata.

METHODS

new

my SIRTX::Datecode $dc = SIRTX::Datecode->new($type => $value [, %opts ]);

Creates a new datecode object using $type and $value.

The following types are defined:

iso8601

An ISO-8601 date string (YYYY-MM-DD, YYYY-MM, or YYYY, all optionally suffixed with Z).

datecode

A datecode value (as integer).

The special value from is also supported as $type. If from is used an object can be passed that is automatically converted. In addition if the value is not reference (object) it is tried to be parsed as per iso8601. The special value now can be used to create an object for the current time.

Currently no options are defined.

datecode

my $datecode = $dc->datecode;

Returns the datecode as an integer date code.

iso8601

my $iso8601 = $dc->iso8601;

Returns the datecode as an ISO-8601 date string.

AUTHOR

Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2025 by Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)