public void Write(String parameterName, FhirDateTime fhirDateTime) { BsonDocument value = new BsonDocument(); value.Add(new BsonElement("start", BsonDateTime.Create(fhirDateTime.LowerBound()))); value.Add(new BsonElement("end", BsonDateTime.Create(fhirDateTime.UpperBound()))); document.Write(parameterName, value); }
/// <summary> /// { start : lowerbound-of-fhirdatetime, end : upperbound-of-fhirdatetime } /// <seealso cref="ToExpressions(Period)"/>, with lower and upper bounds of FhirDateTime as bounds of the Period. /// </summary> /// <param name="element"></param> /// <returns></returns> private List <Expression> ToExpressions(FhirDateTime element) { if (element == null) { return(null); } var bounds = new List <IndexValue>(); bounds.Add(new IndexValue("start", new DateTimeValue(element.LowerBound()))); bounds.Add(new IndexValue("end", new DateTimeValue(element.UpperBound()))); return(ListOf(new CompositeValue(bounds))); }