コード例 #1
0
        public Task <DateTime?> Detokenize(TokenDate token, Guid correlationId, CancellationToken cancellationToken)
        {
            var tok = token.RawToken();

            if (string.IsNullOrWhiteSpace(tok))
            {
                return(null);
            }
            DateTime?dt = DateTime.Parse(tok);

            return(Task.FromResult(dt));
        }
コード例 #2
0
        public async Task <DateTime?> Detokenize(TokenDate token, Guid correlationId, CancellationToken cancellationToken)
        {
            if (token == null)
            {
                return(null);
            }
            var value = await _tokenizeClient.Detokenize(token.RawToken(), correlationId);

            if (string.IsNullOrWhiteSpace(value))
            {
                return(null);
            }

            if (DateTime.TryParse(value, out var dt))
            {
                return(dt);
            }

            return(null);
        }