1 /* 2 * hunt-time: A time library for D programming language. 3 * 4 * Copyright (C) 2015-2018 HuntLabs 5 * 6 * Website: https://www.huntlabs.net/ 7 * 8 * Licensed under the Apache-2.0 License. 9 * 10 */ 11 12 module hunt.time.format.ResolverStyle; 13 14 /** 15 * Enumeration of different ways to resolve dates and times. 16 * !(p) 17 * Parsing a text string occurs _in two phases. 18 * Phase 1 is a basic text parse according to the fields added to the builder. 19 * Phase 2 resolves the parsed field-value pairs into date and/or time objects. 20 * This style is used to control how phase 2, resolving, happens. 21 * 22 * @implSpec 23 * This is an immutable and thread-safe enum. 24 * 25 * @since 1.8 26 */ 27 public enum ResolverStyle { 28 29 /** 30 * Style to resolve dates and times strictly. 31 * !(p) 32 * Using strict resolution will ensure that all parsed values are within 33 * the outer range of valid values for the field. Individual fields may 34 * be further processed for strictness. 35 * !(p) 36 * For example, resolving year-month and day-of-month _in the ISO calendar 37 * system using strict mode will ensure that the day-of-month is valid 38 * for the year-month, rejecting invalid values. 39 */ 40 STRICT, 41 /** 42 * Style to resolve dates and times _in a smart, or intelligent, manner. 43 * !(p) 44 * Using smart resolution will perform the sensible default for each 45 * field, which may be the same as strict, the same as lenient, or a third 46 * behavior. Individual fields will interpret this differently. 47 * !(p) 48 * For example, resolving year-month and day-of-month _in the ISO calendar 49 * system using smart mode will ensure that the day-of-month is from 50 * 1 to 31, converting any value beyond the last valid day-of-month to be 51 * the last valid day-of-month. 52 */ 53 SMART, 54 /** 55 * Style to resolve dates and times leniently. 56 * !(p) 57 * Using lenient resolution will resolve the values _in an appropriate 58 * lenient manner. Individual fields will interpret this differently. 59 * !(p) 60 * For example, lenient mode allows the month _in the ISO calendar system 61 * to be outside the range 1 to 12. 62 * For example, month 15 is treated as being 3 months after month 12. 63 */ 64 LENIENT 65 66 }