Bugzilla – Attachment 101794 Details for
Bug 24980
Date formatting from JS - use timezone only with dates with offset
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24980: (RM follow-up) Only add timezone if passed a date-time
Bug-24980-RM-follow-up-Only-add-timezone-if-passed.patch (text/plain), 2.59 KB, created by
Martin Renvoize (ashimema)
on 2020-03-26 09:57:13 UTC
(
hide
)
Description:
Bug 24980: (RM follow-up) Only add timezone if passed a date-time
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-03-26 09:57:13 UTC
Size:
2.59 KB
patch
obsolete
>From e79c9c63ccbb8ddf94e66c785fc339accaf3cb79 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 25 Mar 2020 20:41:45 +0000 >Subject: [PATCH] Bug 24980: (RM follow-up) Only add timezone if passed a > date-time > >This patch prevents a timezone from being assigned to the js moment if >the input string is only at the full-date and not date-time resolution > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../intranet-tmpl/prog/en/includes/js-date-format.inc | 2 +- > .../opac-tmpl/bootstrap/en/includes/js-date-format.inc | 10 ++++++++-- > 2 files changed, 9 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc >index b567a86940..621f172ec1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc >@@ -33,7 +33,7 @@ > window.$date = function(value, options) { > var tz = (options&&options.tz)||def_tz; > var m = moment(value); >- if(tz) m.tz(tz); >+ if((m.creationData.format !== 'YYYY-MM-DD')&&tz) m.tz(tz); > > var dateformat = (options&&options.dateformat)||def_date_format; > var withtime = (options&&options.withtime)||false; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc >index 9381684bc6..2fc0e64ffc 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc >@@ -24,10 +24,16 @@ > return time_pattern; > }; > >+ /* >+ * A JS equivilent of the KohaDates TT Plugin. Passed an rfc3339 formatted date string, >+ * or JS Date, the function will return a date string formatted as per the koha instance config. >+ * Optionally accepts a dateformat parameter to allow override of the configured output format >+ * as well as a 'withtime' boolean denoting whether to include time or not in the output string. >+ */ > window.$date = function(value, options) { > var tz = (options&&options.tz)||def_tz; > var m = moment(value); >- if(tz) m.tz(tz); >+ if((m.creationData.format !== 'YYYY-MM-DD')&&tz) m.tz(tz); > > var dateformat = (options&&options.dateformat)||def_date_format; > var withtime = (options&&options.withtime)||false; >@@ -59,4 +65,4 @@ > } > > })(); >-</script> >\ No newline at end of file >+</script> >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24980
:
101794
|
101909
|
101910
|
102157
|
104025
|
104026