Change periods of the day replacements to be case-sensitive #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Go time parsing requires the period of the day value and the layout element to be in the same letter case.
For example, If
pm
in lower case is used as template, it expects the value to be also in lower case (am
,pm
), otherwise an error will be returned by thetime.Parse
functions.This PR changes lunes to replace the day periods elements respecting the define layout case, for example:
layout:
January 02 Monday, 2006, 03:04:05 pm
value:
Febrero 25 jueves, 1993, 02:03:04 a.m.
lang:
es-ES
Before this change, it would translate the value to
February 25 Thursday, 1993, 02:03:04 AM
(upper case AM), which would fail to parse using the time.Parse:With this PR changes, the case is maintained, and the same
Translate
function call will returnFebruary 25 Thursday, 1993, 02:03:04 am
(lower case am), making thetime.Parse
function work as exptected.--
Note: The locale translations lookup for periods of the day are still being compared using case-insensitive, it didn't change. the only thing that was changed is the layout element replacement (
AM
,PM
), that are now replaced using the same layout letter case.