https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24455

Martin Renvoize <martin.renvo...@ptfs-europe.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #100123|0                           |1
        is obsolete|                            |

--- Comment #50 from Martin Renvoize <martin.renvo...@ptfs-europe.com> ---
Created attachment 101712
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101712&action=edit
Bug 24455: Add JS functions to format date and datetime strings

This patch adds the a js-date-format.inc file on each opac and staff interface
(date-format.inc whas not available as name)

When you include that file in your TT, you'll get the following functions
available:

1. $date(raw_date_string, options)

   This function parses a date string, as produced by an api call, and returns
the corresponding date formatted according to 'dateformat' and 'TimeFormat'
parameters.

   For example:

   // dateformat: us
   // timeformat: 12hr
   // Timezone: UTC

   $date('2020-03-23T15:00:00+01:00') // You will get '03/23/2020'

   $date('2020-03-23T15:00:00+01:00', {withtime: true}) // You will get
'03/23/2020 14:00'

   $date('2020-03-23T15:00:00+01:00', {withtime: true, tz: 'Europe/Paris'}) //
You will get '03/23/2020 15:00+01:00'

   Options:

   * dateformat: override date format as configured in staff interface (accepts
also 'rfc3339')

   * timeformat: override time format as configured in staff client (available
options are '12hr' and '24hr')

   * withtime: also print the time part (default false)

   * tz: set the timezone

2. $datetime(raw_date_string, option)

   The same as $date but sets withtime to true

3. $time(raw_date_string, option)

   The same as $datetime but shows only the time part

To test you must implement and test bug 20936, where it will be used

Signed-off-by: Andrew Isherwood <andrew.isherw...@ptfs-europe.com>
Signed-off-by: Kyle M Hall <k...@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvo...@ptfs-europe.com>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to