Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/Date/Language/Russian.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,33 @@ our (@DoW, @DoWs, @MoY, @MoYs, @MoY2, @DoWs2, @AMPM, @Dsuf, %MoY, %DoW);
);

@DoW = (
"\xf0\xcf\xce\xc5\xc4\xc5\xcc\xd8\xce\xc9\xcb", # Понедельник
"\xf7\xd4\xcf\xd2\xce\xc9\xcb", # Вторник
"\xf3\xd2\xc5\xc4\xc1", # Среда
"\xfe\xc5\xd4\xd7\xc5\xd2\xc7", # Четверг
"\xf0\xd1\xd4\xce\xc9\xc3\xc1", # Пятница
"\xf3\xd5\xc2\xc2\xcf\xd4\xc1", # Суббота
"\xf7\xcf\xd3\xcb\xd2\xc5\xd3\xc5\xce\xd8\xc5", # Воскресенье
"\xf0\xcf\xce\xc5\xc4\xc5\xcc\xd8\xce\xc9\xcb", # Понедельник
"\xf7\xd4\xcf\xd2\xce\xc9\xcb", # Вторник
"\xf3\xd2\xc5\xc4\xc1", # Среда
"\xfe\xc5\xd4\xd7\xc5\xd2\xc7", # Четверг
"\xf0\xd1\xd4\xce\xc9\xc3\xc1", # Пятница
"\xf3\xd5\xc2\xc2\xcf\xd4\xc1", # Суббота
);

@DoWs = (
"\xf7\xd3", # Вс
"\xf0\xce", # Пн
"\xf7\xd4", # Вт
"\xf3\xd2", # Ср
"\xfe\xd4", # Чт
"\xf0\xd4", # Пт
"\xf3\xc2", # Сб
"\xf7\xd3", # Вс
);

@DoWs2 = (
"\xf7\xd3\xcb", # Вск
"\xf0\xce\xc4", # Пнд
"\xf7\xd4\xd2", # Втр
"\xf3\xd2\xc4", # Срд
"\xfe\xd4\xd7", # Чтв
"\xf0\xd4\xce", # Птн
"\xf3\xc2\xd4", # Сбт
"\xf7\xd3\xcb", # Вск
);

@AMPM = (
Expand Down
30 changes: 29 additions & 1 deletion t/lang-data.t
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ my %expected = (
Portuguese => { A => "ter\x{e7}a-feira", a => "ter", B => "setembro", b => "set" },
Oromo => { A => "Qibxata", a => "Qib", B => "Fuulbana", b => "Fuu" },
Romanian => { A => "marti", a => "mar", B => "septembrie", b => "sep" },
Russian => { A => "\x{f3}\x{d2}\x{c5}\x{c4}\x{c1}", a => "\x{f3}\x{d2}", B => "\x{f3}\x{c5}\x{ce}\x{d4}\x{d1}\x{c2}\x{d2}\x{d1}", b => "\x{f3}\x{c5}\x{ce}" },
Russian => { A => "\x{f7}\x{d4}\x{cf}\x{d2}\x{ce}\x{c9}\x{cb}", a => "\x{f7}\x{d4}", B => "\x{f3}\x{c5}\x{ce}\x{d4}\x{d1}\x{c2}\x{d2}\x{d1}", b => "\x{f3}\x{c5}\x{ce}" },
Russian_cp1251 => { A => "\x{c2}\x{f2}\x{ee}\x{f0}\x{ed}\x{e8}\x{ea}", a => "\x{c2}\x{f2}\x{f0}", B => "\x{d1}\x{e5}\x{ed}\x{f2}\x{ff}\x{e1}\x{f0}\x{fc}", b => "\x{d1}\x{e5}\x{ed}" },
Russian_koi8r => { A => "\x{f7}\x{d4}\x{cf}\x{d2}\x{ce}\x{c9}\x{cb}", a => "\x{f7}\x{d4}\x{d2}", B => "\x{f3}\x{c5}\x{ce}\x{d4}\x{d1}\x{c2}\x{d2}\x{d8}", b => "\x{f3}\x{c5}\x{ce}" },
Sidama => { A => "Maakisanyo", a => "Maa", B => "September", b => "Sep" },
Expand Down Expand Up @@ -88,4 +88,32 @@ for my $lang (sort keys %expected) {
"Romanian: November is noiembrie, not noembrie");
}

# Regression test: Russian @DoW must start with Sunday (index 0 = localtime wday 0)
# Bug: @DoW previously started at Monday, causing every day name to be off by one.
{
my $ru = Date::Language->new('Russian');

# Sat Jan 1 00:00:00 2000 UTC — wday=6 (Saturday)
my $sat = 946684800;
# Sun Jan 2 00:00:00 2000 UTC — wday=0 (Sunday)
my $sun = 946771200;
# Mon Jan 3 00:00:00 2000 UTC — wday=1 (Monday)
my $mon = 946857600;

# Saturday = Суббота (KOI8-R: \xf3\xd5\xc2\xc2\xcf\xd4\xc1)
is($ru->time2str('%A', $sat, 'GMT'),
"\xf3\xd5\xc2\xc2\xcf\xd4\xc1",
"Russian: Saturday formats as Суббота");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is correct


# Sunday = Воскресенье (KOI8-R: \xf7\xcf\xd3\xcb\xd2\xc5\xd3\xc5\xce\xd8\xc5)
is($ru->time2str('%A', $sun, 'GMT'),
"\xf7\xcf\xd3\xcb\xd2\xc5\xd3\xc5\xce\xd8\xc5",
"Russian: Sunday formats as Воскресенье");

# Monday = Понедельник (KOI8-R: \xf0\xcf\xce\xc5\xc4\xc5\xcc\xd8\xce\xc9\xcb)
is($ru->time2str('%A', $mon, 'GMT'),
"\xf0\xcf\xce\xc5\xc4\xc5\xcc\xd8\xce\xc9\xcb",
"Russian: Monday formats as Понедельник");
}

done_testing;
Loading