mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-01-26 21:57:08 -05:00
24 lines
1019 B
Plaintext
24 lines
1019 B
Plaintext
# vim:fileencoding=utf-8
|
|
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
|
|
from __python__ import bound_methods, hash_literals
|
|
|
|
from date import format_date
|
|
from testing import test, assert_equal
|
|
|
|
|
|
def test_fd(date, fmt, ans):
|
|
q = format_date(date, fmt, as_utc=True)
|
|
assert_equal(ans, q)
|
|
|
|
@test
|
|
def date_formatting():
|
|
test_fd('1101-01-01T09:00:00+00:00', 'hh h', '09 9')
|
|
test_fd('1101-01-01T12:15:00+00:00', 'h:m ap', '12:15 pm')
|
|
test_fd('1101-01-01T00:15:00+00:00', 'h:m ap', '12:15 am')
|
|
test_fd('1101-01-01T13:15:00+00:00', 'h:m ap', '1:15 pm')
|
|
test_fd('1101-01-01T09:01:00+00:00', 'h:mm AP', '9:01 AM')
|
|
test_fd('1101-01-01T09:05:01.012+00:00', 'hh h mm m ss s z zzz ap AP a A yy yyyy', '09 9 05 5 01 1 12 012 am AM am AM 01 1101')
|
|
test_fd('2001-01-02T09:00:00+00:00', 'M MM MMM MMMM', '1 01 Jan January')
|
|
test_fd('2001-01-01T12:00:00+00:00', 'd dd ddd dddd', '1 01 Mon Monday')
|
|
# test_fd('2001-01-01T12:00:00+05:30', 'd t', '1 India Standard Time')
|