Commit 4d6dfe865431cb77b3f22d238285a2c975983184

Authored by David RENÉ
1 parent 56b76ecc

fix bug in get_date which returned date without last digit of the day. For examp…

…le if the date was 2000-12-25 the returned date was 2000-12-2
Showing 1 changed file with 21 additions and 2 deletions   Show diff stats
database/db_types.anubis
... ... @@ -323,7 +323,7 @@ public define String
323 323 DB_datetime dt
324 324 )=
325 325 with ba_dt = to_byte_array(dt.datetime),
326   - to_string(extract(ba_dt, 0, 9))
  326 + to_string(extract(ba_dt, 0, 10))
327 327 .
328 328  
329 329 public define String
... ... @@ -370,6 +370,14 @@ public define DB_date
370 370 .
371 371  
372 372 public define Maybe(DB_date)
  373 + datetime_to_mb_date
  374 + (
  375 + DB_datetime dt
  376 + )=
  377 + success(db_date(get_date(dt)))
  378 +.
  379 +
  380 +public define Maybe(DB_date)
373 381 mb_datetime_to_mb_date
374 382 (
375 383 Maybe(DB_datetime) mb_dt
... ... @@ -379,7 +387,18 @@ public define Maybe(DB_date)
379 387 failure then failure,
380 388 success(dt) then success(db_date(get_date(dt)))
381 389 }
382   -
  390 +.
  391 +
  392 +public define Maybe(DB_date)
  393 + to_mb_date
  394 + (
  395 + String _date
  396 + )=
  397 + if _ISO_8601_date_to_Int(_date) is
  398 + {
  399 + failure then failure,
  400 + success(int_date) then success(db_date(_Int_to_ISO_8601_date(int_date)))
  401 + }
383 402 .
384 403 /********** Some default type values ********************/
385 404  
... ...