forked from waja/action-debian-package
		
	
		
			
				
	
	
		
			88 lines
		
	
	
	
		
			2.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
	
		
			2.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /* eslint no-unused-vars: "off" */
 | |
| import { ZoneIsAbstractError } from "./errors.js";
 | |
| 
 | |
| /**
 | |
|  * @interface
 | |
|  */
 | |
| export default class Zone {
 | |
|   /**
 | |
|    * The type of zone
 | |
|    * @abstract
 | |
|    * @type {string}
 | |
|    */
 | |
|   get type() {
 | |
|     throw new ZoneIsAbstractError();
 | |
|   }
 | |
| 
 | |
|   /**
 | |
|    * The name of this zone.
 | |
|    * @abstract
 | |
|    * @type {string}
 | |
|    */
 | |
|   get name() {
 | |
|     throw new ZoneIsAbstractError();
 | |
|   }
 | |
| 
 | |
|   /**
 | |
|    * Returns whether the offset is known to be fixed for the whole year.
 | |
|    * @abstract
 | |
|    * @type {boolean}
 | |
|    */
 | |
|   get universal() {
 | |
|     throw new ZoneIsAbstractError();
 | |
|   }
 | |
| 
 | |
|   /**
 | |
|    * Returns the offset's common name (such as EST) at the specified timestamp
 | |
|    * @abstract
 | |
|    * @param {number} ts - Epoch milliseconds for which to get the name
 | |
|    * @param {Object} opts - Options to affect the format
 | |
|    * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
 | |
|    * @param {string} opts.locale - What locale to return the offset name in.
 | |
|    * @return {string}
 | |
|    */
 | |
|   offsetName(ts, opts) {
 | |
|     throw new ZoneIsAbstractError();
 | |
|   }
 | |
| 
 | |
|   /**
 | |
|    * Returns the offset's value as a string
 | |
|    * @abstract
 | |
|    * @param {number} ts - Epoch milliseconds for which to get the offset
 | |
|    * @param {string} format - What style of offset to return.
 | |
|    *                          Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
 | |
|    * @return {string}
 | |
|    */
 | |
|   formatOffset(ts, format) {
 | |
|     throw new ZoneIsAbstractError();
 | |
|   }
 | |
| 
 | |
|   /**
 | |
|    * Return the offset in minutes for this zone at the specified timestamp.
 | |
|    * @abstract
 | |
|    * @param {number} ts - Epoch milliseconds for which to compute the offset
 | |
|    * @return {number}
 | |
|    */
 | |
|   offset(ts) {
 | |
|     throw new ZoneIsAbstractError();
 | |
|   }
 | |
| 
 | |
|   /**
 | |
|    * Return whether this Zone is equal to another zone
 | |
|    * @abstract
 | |
|    * @param {Zone} otherZone - the zone to compare
 | |
|    * @return {boolean}
 | |
|    */
 | |
|   equals(otherZone) {
 | |
|     throw new ZoneIsAbstractError();
 | |
|   }
 | |
| 
 | |
|   /**
 | |
|    * Return whether this Zone is valid.
 | |
|    * @abstract
 | |
|    * @type {boolean}
 | |
|    */
 | |
|   get isValid() {
 | |
|     throw new ZoneIsAbstractError();
 | |
|   }
 | |
| }
 |