react-native-masked-text
react-native-masked-text copied to clipboard
Current date format is not according moment ISO8601
According moment docs the current pattern for ISO8601
is YYYY-MM-DDTHH:mm:ssZ and not DD/MM/YYYY HH:mm:ss. I not understand the exact point where the date or if is converted to a global
pattern before be applied to the mask passed as argument. All tests cover the date in numeric
format, the date is converted from react component before be pass to getValue
function in datetime.mask.js
?
Sorry man, but I didn't understand your question.
This lib is for masked texts, we use moment
just to validate if you put a valid date into the masked value and to get raw date value using getRawValue
func.
Sorry man, I not explain the question properly. I have the follow situation:
<TextMask
value={this.state.alert.date}
type={'datetime'}
options={{
format: 'DD/MM/YYYY'
}}
/>
The value in this.state.alert.date
is 2018-12-30T00:00:00
. When mask my date, it masked to 20/18/12
. Per my debug I think that is because the default format that Lib accept the date is DD/MM/YYYY HH:mm:ss
. I would like to suggest the 'convertion' of format YYYY-MM-DDTHH:mm:ssZ
before mask because is the official format to datetime
. I would be grateful to make a pull request if this change is welcome.
<TextMask value={this.state.alert.date} type={'datetime'} options={{ format: 'DD/MM/YYYY' }} />
<TextMask value={this.state.alert.date} type={'datetime'} options={{ format: 'DD/MM/YYYY' }} />
What is the output for input 2018-12-30T00:00:00
and this configuration? In my test was 20/18/12
that not would be the right output.