Ejemplo n.º 1
0
        public static string DateValue(TimexProperty timexProperty)
        {
            if (timexProperty.Year != null && timexProperty.Month != null && timexProperty.DayOfMonth != null)
            {
                return($"{TimexDateHelpers.FixedFormatNumber(timexProperty.Year, 4)}-{TimexDateHelpers.FixedFormatNumber(timexProperty.Month, 2)}-{TimexDateHelpers.FixedFormatNumber(timexProperty.DayOfMonth, 2)}");
            }

            return(string.Empty);
        }
Ejemplo n.º 2
0
        public static string TimeValue(TimexProperty timexProperty)
        {
            if (timexProperty.Hour != null && timexProperty.Minute != null && timexProperty.Second != null)
            {
                return($"{TimexDateHelpers.FixedFormatNumber(timexProperty.Hour, 2)}:{TimexDateHelpers.FixedFormatNumber(timexProperty.Minute, 2)}:{TimexDateHelpers.FixedFormatNumber(timexProperty.Second, 2)}");
            }

            return(string.Empty);
        }
Ejemplo n.º 3
0
        private static string FormatTime(TimexProperty timex)
        {
            if (timex.Minute == 0 && timex.Second == 0)
            {
                return($"T{TimexDateHelpers.FixedFormatNumber(timex.Hour, 2)}");
            }

            if (timex.Second == 0)
            {
                return($"T{TimexDateHelpers.FixedFormatNumber(timex.Hour, 2)}:{TimexDateHelpers.FixedFormatNumber(timex.Minute, 2)}");
            }

            return($"T{TimexDateHelpers.FixedFormatNumber(timex.Hour, 2)}:{TimexDateHelpers.FixedFormatNumber(timex.Minute, 2)}:{TimexDateHelpers.FixedFormatNumber(timex.Second, 2)}");
        }
Ejemplo n.º 4
0
        private static string FormatDateRange(TimexProperty timex)
        {
            if (timex.Year != null && timex.WeekOfYear != null && timex.Weekend != null)
            {
                return($"{TimexDateHelpers.FixedFormatNumber(timex.Year, 4)}-W{TimexDateHelpers.FixedFormatNumber(timex.WeekOfYear, 2)}-WE");
            }

            if (timex.Year != null && timex.WeekOfYear != null)
            {
                return($"{TimexDateHelpers.FixedFormatNumber(timex.Year, 4)}-W{TimexDateHelpers.FixedFormatNumber(timex.WeekOfYear, 2)}");
            }

            if (timex.Year != null && timex.Season != null)
            {
                return($"{TimexDateHelpers.FixedFormatNumber(timex.Year, 4)}-{timex.Season}");
            }

            if (timex.Season != null)
            {
                return($"{timex.Season}");
            }

            if (timex.Year != null && timex.Month != null)
            {
                return($"{TimexDateHelpers.FixedFormatNumber(timex.Year, 4)}-{TimexDateHelpers.FixedFormatNumber(timex.Month, 2)}");
            }

            if (timex.Year != null)
            {
                return($"{TimexDateHelpers.FixedFormatNumber(timex.Year, 4)}");
            }

            if (timex.Month != null && timex.WeekOfMonth != null && timex.DayOfWeek != null)
            {
                return($"XXXX-{TimexDateHelpers.FixedFormatNumber(timex.Month, 2)}-WXX-{timex.WeekOfMonth}-{timex.DayOfWeek}");
            }

            if (timex.Month != null && timex.WeekOfMonth != null)
            {
                return($"XXXX-{TimexDateHelpers.FixedFormatNumber(timex.Month, 2)}-WXX-{timex.WeekOfMonth}");
            }

            if (timex.Month != null)
            {
                return($"XXXX-{TimexDateHelpers.FixedFormatNumber(timex.Month, 2)}");
            }

            return(string.Empty);
        }