%%
%% This is file `PJLdate.sty',
%% generated with the docstrip utility.

%% Copyright (C) 2021 by Jinwen XU
%% 
%% This is part of the ProjLib Toolkit.
%% 
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
%% your option) any later version. The latest version of this license is in
%% 
%%     http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of LaTeX version
%% 2005/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[2020-10-01]
\ProvidesPackage{PJLdate}
    [2021/08/19 Convert yyyy-mm-dd to normal datetime format]
\RequirePackage{kvoptions}
\RequirePackage{etoolbox}
\SetupKeyvalOptions{
    family = @PJLdate,
    prefix = @PJLdate@,
}
\DeclareBoolOption[false]{draft}
\DeclareBoolOption[false]{fast}
\ProcessKeyvalOptions*\relax
\if@PJLdate@draft
    \@PJLdate@fasttrue
\fi
\DeclareDocumentCommand{\PLdate}{}{\PJLdate}
\if@PJLdate@fast\let\PJLdate\relax\endinput\fi

\RequirePackage{PJLlang}

\robustify\@latex@warning@no@line

\RequirePackage{silence}
\WarningFilter*{datetime2}{Date-Time Language Module}
\PassOptionsToPackage{fr-FR,en-US}{datetime2}
\RequirePackage{datetime2}
\RequirePackage{zhnumber}

\let\@DTMdate@PJLoriginal\@DTMdate
\gappto{\PJLlang@langconfig@common}{%
    \let\@DTMdate\@DTMdate@PJLoriginal%
}
\gappto{\PJLlang@langconfig@CN}{%
    \renewcommand*{\@DTMdate}[1]{%
    \expandafter\@dtm@parsedate#1\@dtm@endparsedate%
    \zhdate{\@dtm@year/\@dtm@month/\@dtm@day}%
    }%
}
\gappto{\PJLlang@langconfig@TC}{%
    \renewcommand*{\@DTMdate}[1]{%
    \expandafter\@dtm@parsedate#1\@dtm@endparsedate%
    \zhdate{\@dtm@year/\@dtm@month/\@dtm@day}%
    }%
}
\gappto{\PJLlang@langconfig@JP}{%
    \renewcommand*{\@DTMdate}[1]{%
    \expandafter\@dtm@parsedate#1\@dtm@endparsedate%
    \zhdate{\@dtm@year/\@dtm@month/\@dtm@day}%
    }%
}

\providecommand*{\PJLdate}[1]{\DTMdate{#1}}

\endinput
%%
%% End of file `PJLdate.sty'.
