import { DateTime } from 'luxon'; import { Time } from './Time'; import { AstronomicalCalendar } from '../AstronomicalCalendar'; /** * A class used to format both non {@link java.util.Date} times generated by the Zmanim package as well as Dates. For * example the {@link AstronomicalCalendar#getTemporalHour()} returns the length of the hour in * milliseconds. This class can format this time. * * @author © Eliyahu Hershfeld 2004 - 2019 * @version 1.2 */ export declare class ZmanimFormatter { /** * Setting to prepend a zero to single digit hours. * @see #setSettings(boolean, boolean, boolean) */ private prependZeroHours; /** * Should seconds be used in formatting time. * @see #setSettings(boolean, boolean, boolean) */ private useSeconds; /** * @see #setSettings(boolean, boolean, boolean) */ private useMillis; /** * the formatter for minutes as seconds. */ private static readonly minuteSecondNF; /** * the formatter for hours. */ private hourNF; /** * the formatter for minutes as milliseconds. */ private static readonly milliNF; /** * @see #setDateFormat(SimpleDateFormat) */ private dateFormat; /** * Method to return the TimeZone. * @see #setTimeZone(TimeZone) */ private timeZoneId; /** * @return the timeZone */ getTimeZone(): string; /** * Method to set the TimeZone. * @param timeZoneId * the timeZone to set */ setTimeZone(timeZoneId: string): void; /** * Format using hours, minutes, seconds and milliseconds using the xsd:time format. This format will return * 00.00.00.0 when formatting 0. */ static readonly SEXAGESIMAL_XSD_FORMAT: number; /** * Defaults to {@link #SEXAGESIMAL_XSD_FORMAT}. * @see #setTimeFormat(int) */ private timeFormat; /** * Format using standard decimal format with 5 positions after the decimal. */ static readonly DECIMAL_FORMAT: number; /** Format using hours and minutes. */ static readonly SEXAGESIMAL_FORMAT: number; /** Format using hours, minutes and seconds. */ static readonly SEXAGESIMAL_SECONDS_FORMAT: number; /** Format using hours, minutes, seconds and milliseconds. */ static readonly SEXAGESIMAL_MILLIS_FORMAT: number; /** constant for milliseconds in a minute (60,000) */ static readonly MINUTE_MILLIS: number; /** constant for milliseconds in an hour (3,600,000) */ static readonly HOUR_MILLIS: number; /** * Format using the XSD Duration format. This is in the format of PT1H6M7.869S (P for period (duration), T for time, * H, M and S indicate hours, minutes and seconds. */ static readonly XSD_DURATION_FORMAT: number; static readonly XSD_DATE_FORMAT = "yyyy-LL-dd'T'HH:mm:ss"; /** * Constructor that defaults to this will use the format "h:mm:ss" for dates and 00.00.00.0 for {@link Time}. * @param timeZone the TimeZone Object */ /** * ZmanimFormatter constructor using a formatter * * @param format * int The formatting style to use. Using ZmanimFormatter.SEXAGESIMAL_SECONDS_FORMAT will format the * time of 90*60*1000 + 1 as 1:30:00 * @param dateFormat the SimpleDateFormat Object * @param timeZone the TimeZone Object */ constructor(timeZoneId: string); constructor(format: number, dateFormat: string, timeZoneId: string); /** * Sets the format to use for formatting. * * @param format * int the format constant to use. */ setTimeFormat(format: number): void; /** * Sets the SimpleDateFormat Object * @param dateFormat the SimpleDateFormat Object to set */ setDateFormat(dateFormat: string): void; /** * returns the SimpleDateFormat Object * @return the SimpleDateFormat Object */ getDateFormat(): string; /** * Sets various format settings. * @param prependZeroHours if to prepend a zero for single digit hours (so that 1 o'clock is displayed as 01) * @param useSeconds should seconds be used in the time format * @param useMillis should milliseconds be used in formatting time. */ private setSettings; /** * A method that formats milliseconds into a time format. * * @param milliseconds * The time in milliseconds. * @return String The formatted String */ /** * A method that formats milliseconds into a time format. * * @param millis * The time in milliseconds. * @return String The formatted String */ /** * A method that formats {@link Time} objects. * * @param time * The time Object to be formatted. * @return String The formatted String */ format(timeOrMillis: Time | number): string; /** * Formats a date using this class's {@link #getDateFormat() date format}. * * @param dateTime - the date to format * @return the formatted String */ formatDateTime(dateTime: DateTime): string; /** * The date:date-time function returns the current date and time as a date/time string. The date/time string that's * returned must be a string in the format defined as the lexical representation of xs:dateTime in [3.3.8 dateTime] of [XML Schema 1.1 Part 2: Datatypes]. The date/time format is * basically CCYY-MM-DDThh:mm:ss, although implementers should consult [XML Schema 1.1 Part 2: Datatypes] and [ISO 8601] for details. The date/time string format must include a * time zone, either a Z to indicate Coordinated Universal Time or a + or - followed by the difference between the * difference from UTC represented as hh:mm. * @param dateTime - the UTC Date Object * @return the XSD dateTime */ getXSDateTime(dateTime: DateTime): string; /** * This returns the xml representation of an xsd:duration object. * * @param millis * the duration in milliseconds * @return the xsd:duration formatted String */ /** * This returns the xml representation of an xsd:duration object. * * @param time * the duration as a Time object * @return the xsd:duration formatted String */ static formatXSDDurationTime(timeOrMillis: Time | number): string; static formatDecimal(num: number): string; /** * A method that returns an XML formatted String representing the serialized Object. The * format used is: * *
     *  <AstronomicalTimes date="1969-02-08" type="AstronomicalCalendar algorithm="US Naval Almanac Algorithm" location="Lakewood, NJ" latitude="40.095965" longitude="-74.22213" elevation="31.0" timeZoneName="Eastern Standard Time" timeZoneID="America/New_York" timeZoneOffset="-5">
     *     <Sunrise>2007-02-18T06:45:27-05:00</Sunrise>
     *     <TemporalHour>PT54M17.529S</TemporalHour>
     *     ...
     *   </AstronomicalTimes>
     * 
* * Note that the output uses the xsd:dateTime format for * times such as sunrise, and xsd:duration format for * times that are a duration such as the length of a * {@link AstronomicalCalendar#getTemporalHour() temporal hour}. The output of this method is * returned by the {@link #toString() toString}. * * @param astronomicalCalendar the AstronomicalCalendar Object * * @return The XML formatted String. The format will be: * *
     *  <AstronomicalTimes date="1969-02-08" type="AstronomicalCalendar algorithm="US Naval Almanac Algorithm" location="Lakewood, NJ" latitude="40.095965" longitude="-74.22213" elevation="31.0" timeZoneName="Eastern Standard Time" timeZoneID="America/New_York" timeZoneOffset="-5">
     *     <Sunrise>2007-02-18T06:45:27-05:00</Sunrise>
     *     <TemporalHour>PT54M17.529S</TemporalHour>
     *     ...
     *  </AstronomicalTimes>
     * 
* * TODO: add proper schema, and support for nulls. XSD duration (for solar hours), should probably return * nil and not P * @deprecated */ static toXML(): void; /** * A method that returns a JSON formatted String representing the serialized Object. The * format used is: *
     * {
     *    "metadata":{
     *      "date":"1969-02-08",
     *      "type":"AstronomicalCalendar",
     *      "algorithm":"US Naval Almanac Algorithm",
     *      "location":"Lakewood, NJ",
     *      "latitude":"40.095965",
     *      "longitude":"-74.22213",
     *      "elevation:"31.0",
     *      "timeZoneName":"Eastern Standard Time",
     *      "timeZoneID":"America/New_York",
     *      "timeZoneOffset":"-5"},
     *    "AstronomicalTimes":{
     *     "Sunrise":"2007-02-18T06:45:27-05:00",
     *     "TemporalHour":"PT54M17.529S"
     *     ...
     *     }
     * }
     * 
* * Note that the output uses the xsd:dateTime format for * times such as sunrise, and xsd:duration format for * times that are a duration such as the length of a * {@link AstronomicalCalendar#getTemporalHour() temporal hour}. * * @param astronomicalCalendar the AstronomicalCalendar Object * * @return The JSON formatted String. The format will be: *
     * {
     *    "metadata":{
     *      "date":"1969-02-08",
     *      "type":"AstronomicalCalendar",
     *      "algorithm":"US Naval Almanac Algorithm",
     *      "location":"Lakewood, NJ",
     *      "latitude":"40.095965",
     *      "longitude":"-74.22213",
     *      "elevation:"31.0",
     *      "timeZoneName":"Eastern Standard Time",
     *      "timeZoneID":"America/New_York",
     *      "timeZoneOffset":"-5"},
     *    "AstronomicalTimes":{
     *     "Sunrise":"2007-02-18T06:45:27-05:00",
     *     "TemporalHour":"PT54M17.529S"
     *     ...
     *     }
     * }
     * 
*/ static toJSON(astronomicalCalendar: AstronomicalCalendar): JsonOutput; private static getOutputKey; private static getOutputMetadata; private static getZmanimOutput; } export interface JsonOutput { metadata: OutputMetadata; [key: string]: object; } export interface OutputMetadata { date: string; type: string; algorithm: string; location: string | null; latitude: string; longitude: string; elevation: string; timeZoneName: string; timeZoneID: string; timeZoneOffset: string; }