Пример #1
0
 def test_parser__ddmmyyyy_slash_delim(self):
     input_format = "21/01/2020"
     result = parse_date_str(input_format)
     self.assertEqual("%d/%m/%Y", result)
Пример #2
0
 def test_parser__iso8601(self):
     input_format = "2020-02-23T18:47:17+11:00"
     result = parse_date_str(input_format)
     self.assertEqual("%Y-%m-%dT%H:%M:%S%Z", result)
Пример #3
0
 def test_parser__YYYY_dash_mm_dash_dd(self):
     input_format = "2020-02-21"
     result = parse_date_str(input_format)
     self.assertEqual("%Y-%m-%d", result)
Пример #4
0
 def test_parser__hhmmsspm_colon_delim_24hr(self):
     input_format = "19:11:23 PM"
     result = parse_date_str(input_format)
     self.assertEqual("%H:%M:%S %p", result)
Пример #5
0
 def test_parser__shortDayddthShortMonthYYYY(self):
     input_format = "Mon 9th Jan 2020"
     result = parse_date_str(input_format)
     self.assertEqual("%a %dth %b %Y", result)
Пример #6
0
 def test_parser__ddLongMonthyyyy_space_delim(self):
     input_format = "21 February 2020"
     result = parse_date_str(input_format)
     self.assertEqual("%d %B %Y", result)
Пример #7
0
 def test_parser__ddShortMonthyyyy_space_delim(self):
     input_format = "21 Feb 2020"
     result = parse_date_str(input_format)
     self.assertEqual("%d %b %Y", result)
Пример #8
0
def format():
    dt = request.form["dateFormat"]
    formatted = parse_date_str(dt)
    if not formatted:
        return "", 400
    return jsonify({"message": f".strftime('{formatted}')"})