Bug 24980: Only add timezone if passed a date-time
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 25 Mar 2020 20:41:45 +0000 (20:41 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 1 May 2020 07:12:48 +0000 (08:12 +0100)
commit03ea4bd0cc058bd3ca1c2e339371f45afc6c0244
tree28b8407902f097eca8e1ec3f2be2d0b9ffc5492e
parent5b2c79f1ea8313f6e0328d3efa2ea190b184c1d1
Bug 24980: 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

To test:
1. Do not apply this patch
2. Set your system time zone to CET
3. Apply previous patch (It's just for test)
4. In your browser go to koha main page, open a console and type $date('2020-03-25', {tz:
   'UTC'})
CHECK => you sould get '03/24/2020' (notice day is 24 instead of 25)
5. Apply this patch and reload the browser
6. repeat step 4
SUCCESS => now you get '03/25/2020' (day is correct)
7. Sing off

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc