balinese-date-js-lib
Version:
Library to Develop Balinese Saka Calendar (Kalender Bali)
1,411 lines (1,307 loc) • 86.7 kB
JavaScript
/*!
* BalineseDate is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
* BalineseDate (UMD) is bundled with **date-fns** that licensed under the [MIT license](http://kossnocorp.mit-license.org).
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define("BalineseDate", [], factory);
else if(typeof exports === 'object')
exports["BalineseDate"] = factory();
else
root["BalineseDate"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./src/BalineseDate.ts");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds/index.js":
/*!*****************************************************************************!*\
!*** ./node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds/index.js ***!
\*****************************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var MILLISECONDS_IN_MINUTE = 60000
/**
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
* They usually appear for dates that denote time before the timezones were introduced
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
* and GMT+01:00:00 after that date)
*
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
* which would lead to incorrect calculations.
*
* This function returns the timezone offset in milliseconds that takes seconds in account.
*/
module.exports = function getTimezoneOffsetInMilliseconds (dirtyDate) {
var date = new Date(dirtyDate.getTime())
var baseTimezoneOffset = date.getTimezoneOffset()
date.setSeconds(0, 0)
var millisecondsPartOfTimezoneOffset = date.getTime() % MILLISECONDS_IN_MINUTE
return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset
}
/***/ }),
/***/ "./node_modules/date-fns/add_days/index.js":
/*!*************************************************!*\
!*** ./node_modules/date-fns/add_days/index.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(/*! ../parse/index.js */ "./node_modules/date-fns/parse/index.js")
/**
* @category Day Helpers
* @summary Add the specified number of days to the given date.
*
* @description
* Add the specified number of days to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of days to be added
* @returns {Date} the new date with the days added
*
* @example
* // Add 10 days to 1 September 2014:
* var result = addDays(new Date(2014, 8, 1), 10)
* //=> Thu Sep 11 2014 00:00:00
*/
function addDays (dirtyDate, dirtyAmount) {
var date = parse(dirtyDate)
var amount = Number(dirtyAmount)
date.setDate(date.getDate() + amount)
return date
}
module.exports = addDays
/***/ }),
/***/ "./node_modules/date-fns/compare_asc/index.js":
/*!****************************************************!*\
!*** ./node_modules/date-fns/compare_asc/index.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(/*! ../parse/index.js */ "./node_modules/date-fns/parse/index.js")
/**
* @category Common Helpers
* @summary Compare the two dates and return -1, 0 or 1.
*
* @description
* Compare the two dates and return 1 if the first date is after the second,
* -1 if the first date is before the second or 0 if dates are equal.
*
* @param {Date|String|Number} dateLeft - the first date to compare
* @param {Date|String|Number} dateRight - the second date to compare
* @returns {Number} the result of the comparison
*
* @example
* // Compare 11 February 1987 and 10 July 1989:
* var result = compareAsc(
* new Date(1987, 1, 11),
* new Date(1989, 6, 10)
* )
* //=> -1
*
* @example
* // Sort the array of dates:
* var result = [
* new Date(1995, 6, 2),
* new Date(1987, 1, 11),
* new Date(1989, 6, 10)
* ].sort(compareAsc)
* //=> [
* // Wed Feb 11 1987 00:00:00,
* // Mon Jul 10 1989 00:00:00,
* // Sun Jul 02 1995 00:00:00
* // ]
*/
function compareAsc (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var timeLeft = dateLeft.getTime()
var dateRight = parse(dirtyDateRight)
var timeRight = dateRight.getTime()
if (timeLeft < timeRight) {
return -1
} else if (timeLeft > timeRight) {
return 1
} else {
return 0
}
}
module.exports = compareAsc
/***/ }),
/***/ "./node_modules/date-fns/difference_in_calendar_days/index.js":
/*!********************************************************************!*\
!*** ./node_modules/date-fns/difference_in_calendar_days/index.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var startOfDay = __webpack_require__(/*! ../start_of_day/index.js */ "./node_modules/date-fns/start_of_day/index.js")
var MILLISECONDS_IN_MINUTE = 60000
var MILLISECONDS_IN_DAY = 86400000
/**
* @category Day Helpers
* @summary Get the number of calendar days between the given dates.
*
* @description
* Get the number of calendar days between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of calendar days
*
* @example
* // How many calendar days are between
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
* var result = differenceInCalendarDays(
* new Date(2012, 6, 2, 0, 0),
* new Date(2011, 6, 2, 23, 0)
* )
* //=> 366
*/
function differenceInCalendarDays (dirtyDateLeft, dirtyDateRight) {
var startOfDayLeft = startOfDay(dirtyDateLeft)
var startOfDayRight = startOfDay(dirtyDateRight)
var timestampLeft = startOfDayLeft.getTime() -
startOfDayLeft.getTimezoneOffset() * MILLISECONDS_IN_MINUTE
var timestampRight = startOfDayRight.getTime() -
startOfDayRight.getTimezoneOffset() * MILLISECONDS_IN_MINUTE
// Round the number of days to the nearest integer
// because the number of milliseconds in a day is not constant
// (e.g. it's different in the day of the daylight saving time clock shift)
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY)
}
module.exports = differenceInCalendarDays
/***/ }),
/***/ "./node_modules/date-fns/is_date/index.js":
/*!************************************************!*\
!*** ./node_modules/date-fns/is_date/index.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
/**
* @category Common Helpers
* @summary Is the given argument an instance of Date?
*
* @description
* Is the given argument an instance of Date?
*
* @param {*} argument - the argument to check
* @returns {Boolean} the given argument is an instance of Date
*
* @example
* // Is 'mayonnaise' a Date?
* var result = isDate('mayonnaise')
* //=> false
*/
function isDate (argument) {
return argument instanceof Date
}
module.exports = isDate
/***/ }),
/***/ "./node_modules/date-fns/parse/index.js":
/*!**********************************************!*\
!*** ./node_modules/date-fns/parse/index.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var getTimezoneOffsetInMilliseconds = __webpack_require__(/*! ../_lib/getTimezoneOffsetInMilliseconds/index.js */ "./node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds/index.js")
var isDate = __webpack_require__(/*! ../is_date/index.js */ "./node_modules/date-fns/is_date/index.js")
var MILLISECONDS_IN_HOUR = 3600000
var MILLISECONDS_IN_MINUTE = 60000
var DEFAULT_ADDITIONAL_DIGITS = 2
var parseTokenDateTimeDelimeter = /[T ]/
var parseTokenPlainTime = /:/
// year tokens
var parseTokenYY = /^(\d{2})$/
var parseTokensYYY = [
/^([+-]\d{2})$/, // 0 additional digits
/^([+-]\d{3})$/, // 1 additional digit
/^([+-]\d{4})$/ // 2 additional digits
]
var parseTokenYYYY = /^(\d{4})/
var parseTokensYYYYY = [
/^([+-]\d{4})/, // 0 additional digits
/^([+-]\d{5})/, // 1 additional digit
/^([+-]\d{6})/ // 2 additional digits
]
// date tokens
var parseTokenMM = /^-(\d{2})$/
var parseTokenDDD = /^-?(\d{3})$/
var parseTokenMMDD = /^-?(\d{2})-?(\d{2})$/
var parseTokenWww = /^-?W(\d{2})$/
var parseTokenWwwD = /^-?W(\d{2})-?(\d{1})$/
// time tokens
var parseTokenHH = /^(\d{2}([.,]\d*)?)$/
var parseTokenHHMM = /^(\d{2}):?(\d{2}([.,]\d*)?)$/
var parseTokenHHMMSS = /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/
// timezone tokens
var parseTokenTimezone = /([Z+-].*)$/
var parseTokenTimezoneZ = /^(Z)$/
var parseTokenTimezoneHH = /^([+-])(\d{2})$/
var parseTokenTimezoneHHMM = /^([+-])(\d{2}):?(\d{2})$/
/**
* @category Common Helpers
* @summary Convert the given argument to an instance of Date.
*
* @description
* Convert the given argument to an instance of Date.
*
* If the argument is an instance of Date, the function returns its clone.
*
* If the argument is a number, it is treated as a timestamp.
*
* If an argument is a string, the function tries to parse it.
* Function accepts complete ISO 8601 formats as well as partial implementations.
* ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
*
* If all above fails, the function passes the given argument to Date constructor.
*
* @param {Date|String|Number} argument - the value to convert
* @param {Object} [options] - the object with options
* @param {0 | 1 | 2} [options.additionalDigits=2] - the additional number of digits in the extended year format
* @returns {Date} the parsed date in the local time zone
*
* @example
* // Convert string '2014-02-11T11:30:30' to date:
* var result = parse('2014-02-11T11:30:30')
* //=> Tue Feb 11 2014 11:30:30
*
* @example
* // Parse string '+02014101',
* // if the additional number of digits in the extended year format is 1:
* var result = parse('+02014101', {additionalDigits: 1})
* //=> Fri Apr 11 2014 00:00:00
*/
function parse (argument, dirtyOptions) {
if (isDate(argument)) {
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
return new Date(argument.getTime())
} else if (typeof argument !== 'string') {
return new Date(argument)
}
var options = dirtyOptions || {}
var additionalDigits = options.additionalDigits
if (additionalDigits == null) {
additionalDigits = DEFAULT_ADDITIONAL_DIGITS
} else {
additionalDigits = Number(additionalDigits)
}
var dateStrings = splitDateString(argument)
var parseYearResult = parseYear(dateStrings.date, additionalDigits)
var year = parseYearResult.year
var restDateString = parseYearResult.restDateString
var date = parseDate(restDateString, year)
if (date) {
var timestamp = date.getTime()
var time = 0
var offset
if (dateStrings.time) {
time = parseTime(dateStrings.time)
}
if (dateStrings.timezone) {
offset = parseTimezone(dateStrings.timezone) * MILLISECONDS_IN_MINUTE
} else {
var fullTime = timestamp + time
var fullTimeDate = new Date(fullTime)
offset = getTimezoneOffsetInMilliseconds(fullTimeDate)
// Adjust time when it's coming from DST
var fullTimeDateNextDay = new Date(fullTime)
fullTimeDateNextDay.setDate(fullTimeDate.getDate() + 1)
var offsetDiff =
getTimezoneOffsetInMilliseconds(fullTimeDateNextDay) -
getTimezoneOffsetInMilliseconds(fullTimeDate)
if (offsetDiff > 0) {
offset += offsetDiff
}
}
return new Date(timestamp + time + offset)
} else {
return new Date(argument)
}
}
function splitDateString (dateString) {
var dateStrings = {}
var array = dateString.split(parseTokenDateTimeDelimeter)
var timeString
if (parseTokenPlainTime.test(array[0])) {
dateStrings.date = null
timeString = array[0]
} else {
dateStrings.date = array[0]
timeString = array[1]
}
if (timeString) {
var token = parseTokenTimezone.exec(timeString)
if (token) {
dateStrings.time = timeString.replace(token[1], '')
dateStrings.timezone = token[1]
} else {
dateStrings.time = timeString
}
}
return dateStrings
}
function parseYear (dateString, additionalDigits) {
var parseTokenYYY = parseTokensYYY[additionalDigits]
var parseTokenYYYYY = parseTokensYYYYY[additionalDigits]
var token
// YYYY or ±YYYYY
token = parseTokenYYYY.exec(dateString) || parseTokenYYYYY.exec(dateString)
if (token) {
var yearString = token[1]
return {
year: parseInt(yearString, 10),
restDateString: dateString.slice(yearString.length)
}
}
// YY or ±YYY
token = parseTokenYY.exec(dateString) || parseTokenYYY.exec(dateString)
if (token) {
var centuryString = token[1]
return {
year: parseInt(centuryString, 10) * 100,
restDateString: dateString.slice(centuryString.length)
}
}
// Invalid ISO-formatted year
return {
year: null
}
}
function parseDate (dateString, year) {
// Invalid ISO-formatted year
if (year === null) {
return null
}
var token
var date
var month
var week
// YYYY
if (dateString.length === 0) {
date = new Date(0)
date.setUTCFullYear(year)
return date
}
// YYYY-MM
token = parseTokenMM.exec(dateString)
if (token) {
date = new Date(0)
month = parseInt(token[1], 10) - 1
date.setUTCFullYear(year, month)
return date
}
// YYYY-DDD or YYYYDDD
token = parseTokenDDD.exec(dateString)
if (token) {
date = new Date(0)
var dayOfYear = parseInt(token[1], 10)
date.setUTCFullYear(year, 0, dayOfYear)
return date
}
// YYYY-MM-DD or YYYYMMDD
token = parseTokenMMDD.exec(dateString)
if (token) {
date = new Date(0)
month = parseInt(token[1], 10) - 1
var day = parseInt(token[2], 10)
date.setUTCFullYear(year, month, day)
return date
}
// YYYY-Www or YYYYWww
token = parseTokenWww.exec(dateString)
if (token) {
week = parseInt(token[1], 10) - 1
return dayOfISOYear(year, week)
}
// YYYY-Www-D or YYYYWwwD
token = parseTokenWwwD.exec(dateString)
if (token) {
week = parseInt(token[1], 10) - 1
var dayOfWeek = parseInt(token[2], 10) - 1
return dayOfISOYear(year, week, dayOfWeek)
}
// Invalid ISO-formatted date
return null
}
function parseTime (timeString) {
var token
var hours
var minutes
// hh
token = parseTokenHH.exec(timeString)
if (token) {
hours = parseFloat(token[1].replace(',', '.'))
return (hours % 24) * MILLISECONDS_IN_HOUR
}
// hh:mm or hhmm
token = parseTokenHHMM.exec(timeString)
if (token) {
hours = parseInt(token[1], 10)
minutes = parseFloat(token[2].replace(',', '.'))
return (hours % 24) * MILLISECONDS_IN_HOUR +
minutes * MILLISECONDS_IN_MINUTE
}
// hh:mm:ss or hhmmss
token = parseTokenHHMMSS.exec(timeString)
if (token) {
hours = parseInt(token[1], 10)
minutes = parseInt(token[2], 10)
var seconds = parseFloat(token[3].replace(',', '.'))
return (hours % 24) * MILLISECONDS_IN_HOUR +
minutes * MILLISECONDS_IN_MINUTE +
seconds * 1000
}
// Invalid ISO-formatted time
return null
}
function parseTimezone (timezoneString) {
var token
var absoluteOffset
// Z
token = parseTokenTimezoneZ.exec(timezoneString)
if (token) {
return 0
}
// ±hh
token = parseTokenTimezoneHH.exec(timezoneString)
if (token) {
absoluteOffset = parseInt(token[2], 10) * 60
return (token[1] === '+') ? -absoluteOffset : absoluteOffset
}
// ±hh:mm or ±hhmm
token = parseTokenTimezoneHHMM.exec(timezoneString)
if (token) {
absoluteOffset = parseInt(token[2], 10) * 60 + parseInt(token[3], 10)
return (token[1] === '+') ? -absoluteOffset : absoluteOffset
}
return 0
}
function dayOfISOYear (isoYear, week, day) {
week = week || 0
day = day || 0
var date = new Date(0)
date.setUTCFullYear(isoYear, 0, 4)
var fourthOfJanuaryDay = date.getUTCDay() || 7
var diff = week * 7 + day + 1 - fourthOfJanuaryDay
date.setUTCDate(date.getUTCDate() + diff)
return date
}
module.exports = parse
/***/ }),
/***/ "./node_modules/date-fns/start_of_day/index.js":
/*!*****************************************************!*\
!*** ./node_modules/date-fns/start_of_day/index.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(/*! ../parse/index.js */ "./node_modules/date-fns/parse/index.js")
/**
* @category Day Helpers
* @summary Return the start of a day for the given date.
*
* @description
* Return the start of a day for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the start of a day
*
* @example
* // The start of a day for 2 September 2014 11:55:00:
* var result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 02 2014 00:00:00
*/
function startOfDay (dirtyDate) {
var date = parse(dirtyDate)
date.setHours(0, 0, 0, 0)
return date
}
module.exports = startOfDay
/***/ }),
/***/ "./src/AstaWara.ts":
/*!*************************!*\
!*** ./src/AstaWara.ts ***!
\*************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class AstaWara {
constructor(id, urip, name) {
this.id = id;
this.urip = urip;
this.name = name;
Object.freeze(this);
}
static get values() { return _C_VAL; }
static get SRI() { return _C_VAL[0]; }
static get INDRA() { return _C_VAL[1]; }
static get GURU() { return _C_VAL[2]; }
static get YAMA() { return _C_VAL[3]; }
static get LUDRA() { return _C_VAL[4]; }
static get BRAHMA() { return _C_VAL[5]; }
static get KALA() { return _C_VAL[6]; }
static get UMA() { return _C_VAL[7]; }
}
exports.AstaWara = AstaWara;
const _C_VAL = [
new AstaWara(0, 6, "Sri"),
new AstaWara(1, 5, "Indra"),
new AstaWara(2, 8, "Guru"),
new AstaWara(3, 9, "Yama"),
new AstaWara(4, 3, "Ludra"),
new AstaWara(5, 7, "Brahma"),
new AstaWara(6, 1, "Kala"),
new AstaWara(7, 4, "Uma"),
];
Object.freeze(_C_VAL);
/***/ }),
/***/ "./src/BalineseDate.ts":
/*!*****************************!*\
!*** ./src/BalineseDate.ts ***!
\*****************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const dateAdd = __webpack_require__(/*! date-fns/add_days */ "./node_modules/date-fns/add_days/index.js");
const dateCompare = __webpack_require__(/*! date-fns/compare_asc */ "./node_modules/date-fns/compare_asc/index.js");
const dateDiff = __webpack_require__(/*! date-fns/difference_in_calendar_days */ "./node_modules/date-fns/difference_in_calendar_days/index.js");
const AstaWara_1 = __webpack_require__(/*! ./AstaWara */ "./src/AstaWara.ts");
exports.AstaWara = AstaWara_1.AstaWara;
const BalineseDateUtil_1 = __webpack_require__(/*! ./BalineseDateUtil */ "./src/BalineseDateUtil.ts");
exports.BalineseDateUtil = BalineseDateUtil_1.BalineseDateUtil;
const CaturWara_1 = __webpack_require__(/*! ./CaturWara */ "./src/CaturWara.ts");
exports.CaturWara = CaturWara_1.CaturWara;
const DasaWara_1 = __webpack_require__(/*! ./DasaWara */ "./src/DasaWara.ts");
exports.DasaWara = DasaWara_1.DasaWara;
const DwiWara_1 = __webpack_require__(/*! ./DwiWara */ "./src/DwiWara.ts");
exports.DwiWara = DwiWara_1.DwiWara;
const EkaJalaRsi_1 = __webpack_require__(/*! ./EkaJalaRsi */ "./src/EkaJalaRsi.ts");
exports.EkaJalaRsi = EkaJalaRsi_1.EkaJalaRsi;
const EkaWara_1 = __webpack_require__(/*! ./EkaWara */ "./src/EkaWara.ts");
exports.EkaWara = EkaWara_1.EkaWara;
const Filter_1 = __webpack_require__(/*! ./Filter */ "./src/Filter.ts");
exports.Filter = Filter_1.Filter;
const Ingkel_1 = __webpack_require__(/*! ./Ingkel */ "./src/Ingkel.ts");
exports.Ingkel = Ingkel_1.Ingkel;
const Pivot_1 = __webpack_require__(/*! ./internal/Pivot */ "./src/internal/Pivot.ts");
const Jejepan_1 = __webpack_require__(/*! ./Jejepan */ "./src/Jejepan.ts");
exports.Jejepan = Jejepan_1.Jejepan;
const Lintang_1 = __webpack_require__(/*! ./Lintang */ "./src/Lintang.ts");
exports.Lintang = Lintang_1.Lintang;
const PancaSuda_1 = __webpack_require__(/*! ./PancaSuda */ "./src/PancaSuda.ts");
exports.PancaSuda = PancaSuda_1.PancaSuda;
const PancaWara_1 = __webpack_require__(/*! ./PancaWara */ "./src/PancaWara.ts");
exports.PancaWara = PancaWara_1.PancaWara;
const Pararasan_1 = __webpack_require__(/*! ./Pararasan */ "./src/Pararasan.ts");
exports.Pararasan = Pararasan_1.Pararasan;
const PratithiSamutPada_1 = __webpack_require__(/*! ./PratithiSamutPada */ "./src/PratithiSamutPada.ts");
exports.PratithiSamutPada = PratithiSamutPada_1.PratithiSamutPada;
const Rahinan_1 = __webpack_require__(/*! ./Rahinan */ "./src/Rahinan.ts");
exports.Rahinan = Rahinan_1.Rahinan;
const Rakam_1 = __webpack_require__(/*! ./Rakam */ "./src/Rakam.ts");
exports.Rakam = Rakam_1.Rakam;
const SadWara_1 = __webpack_require__(/*! ./SadWara */ "./src/SadWara.ts");
exports.SadWara = SadWara_1.SadWara;
const SangaWara_1 = __webpack_require__(/*! ./SangaWara */ "./src/SangaWara.ts");
exports.SangaWara = SangaWara_1.SangaWara;
const SaptaWara_1 = __webpack_require__(/*! ./SaptaWara */ "./src/SaptaWara.ts");
exports.SaptaWara = SaptaWara_1.SaptaWara;
const Sasih_1 = __webpack_require__(/*! ./Sasih */ "./src/Sasih.ts");
exports.Sasih = Sasih_1.Sasih;
const SasihDayInfo_1 = __webpack_require__(/*! ./SasihDayInfo */ "./src/SasihDayInfo.ts");
exports.SasihDayInfo = SasihDayInfo_1.SasihDayInfo;
const TriWara_1 = __webpack_require__(/*! ./TriWara */ "./src/TriWara.ts");
exports.TriWara = TriWara_1.TriWara;
const WatekAlit_1 = __webpack_require__(/*! ./WatekAlit */ "./src/WatekAlit.ts");
exports.WatekAlit = WatekAlit_1.WatekAlit;
const WatekMadya_1 = __webpack_require__(/*! ./WatekMadya */ "./src/WatekMadya.ts");
exports.WatekMadya = WatekMadya_1.WatekMadya;
const Wuku_1 = __webpack_require__(/*! ./Wuku */ "./src/Wuku.ts");
exports.Wuku = Wuku_1.Wuku;
class BalineseDate {
constructor(date = new Date()) {
this.date = new Date(date.getFullYear(), date.getMonth(), date.getDate());
Object.freeze(this.date);
const pivot = _F_BEST_PIVOT(this.date);
const pawukonDay = _F_PAWUKON_DAY(pivot, this.date);
this.wuku = Wuku_1.Wuku.values[Math.floor(pawukonDay / 7)];
this.triWara = TriWara_1.TriWara.values[pawukonDay % 3];
this.pancaWara = PancaWara_1.PancaWara.values[pawukonDay % 5];
this.sadWara = SadWara_1.SadWara.values[pawukonDay % 6];
this.saptaWara = SaptaWara_1.SaptaWara.values[pawukonDay % 7];
this.jejepan = Jejepan_1.Jejepan.values[pawukonDay % 6];
this.lintang = Lintang_1.Lintang.values[pawukonDay % 35];
this.pancaSuda = PancaSuda_1.PancaSuda.values[(this.saptaWara.kertaAji + this.pancaWara.urip) % 7];
this.rakam = Rakam_1.Rakam.values[(this.saptaWara.kupih + this.pancaWara.kupih) % 6];
this.ekaJalaRsi = EkaJalaRsi_1.EkaJalaRsi.values[_C_EJR_MAP[pawukonDay]];
this.ingkel = Ingkel_1.Ingkel.values[this.wuku.id % 6];
const urip = this.pancaWara.urip + this.saptaWara.urip;
this.ekaWara = EkaWara_1.EkaWara.values[urip % 2];
this.dwiWara = DwiWara_1.DwiWara.values[urip % 2];
this.dasaWara = DasaWara_1.DasaWara.values[urip % 10];
this.watekAlit = WatekAlit_1.WatekAlit.values[urip % 4];
this.watekMadya = WatekMadya_1.WatekMadya.values[urip % 5];
this.pararasan = Pararasan_1.Pararasan.values[urip % 10];
this.caturWara = _F_CALC_CATURWARA(pawukonDay);
this.astaWara = _F_CALC_ASTAWARA(pawukonDay);
this.sangaWara = _F_CALC_SANGAWARA(pawukonDay);
const resSasih = _F_CALC_SASIH_INFO(pivot, this.date);
const resSasihDay = _F_CALC_SASIH_DAY(pivot, this.date);
this.saka = resSasih[0];
this.sasih = _F_CALC_SASIH(resSasih);
this.sasihDayInfo = _F_CALC_SASIH_DAY_INFO(resSasihDay, this.sasih, this.saka);
if (resSasihDay[2] === 1) {
this.sasihDay = [resSasihDay[0], ((resSasihDay[0] === 15) ? 1 : resSasihDay[0] + 1)];
}
else {
this.sasihDay = [resSasihDay[0]];
}
Object.freeze(this.sasihDay);
this.pratithiSamutPada = _F_CALC_PRATITHI_S_P(this.sasihDay, this.sasihDayInfo, this.sasih, this.date);
Object.freeze(this);
}
}
exports.BalineseDate = BalineseDate;
const _C_DAY_PAWUKON = 210;
const _C_DAY_NGUNARATRI = 63;
const _C_PANGALANTAKA_PAING = new Date(2000, 0, 6);
Object.freeze(_C_PANGALANTAKA_PAING);
const _C_SK_START = new Date(1993, 0, 24);
Object.freeze(_C_SK_START);
const _C_SK_END = new Date(2003, 0, 3);
Object.freeze(_C_SK_END);
const _C_EJR_MAP = Object.freeze([23, 7, 17, 7, 23, 23, 17, 9, 7, 13, 26, 24, 23, 20, 13, 7, 13, 25, 19, 6, 2,
14, 26, 17, 20, 25, 22, 0, 10, 6, 15, 23, 7, 17, 23, 17, 25, 5, 23, 2, 2, 2, 12, 12, 5, 14, 12, 26, 26, 1,
23, 23, 15, 25, 15, 6, 9, 25, 18, 25, 11, 15, 21, 25, 25, 12, 0, 17, 13, 0, 15, 23, 12, 7, 16, 25, 18, 24,
12, 12, 6, 7, 6, 26, 7, 6, 12, 7, 25, 2, 12, 25, 25, 14, 15, 26, 7, 12, 20, 7, 6, 25, 25, 6, 13, 25, 17, 13,
23, 6, 26, 20, 25, 25, 23, 7, 18, 18, 17, 7, 17, 7, 5, 26, 17, 6, 9, 12, 12, 13, 25, 18, 18, 6, 2, 25, 25,
2, 25, 17, 20, 14, 27, 23, 17, 8, 25, 17, 6, 17, 7, 3, 15, 18, 25, 2, 7, 13, 25, 20, 7, 15, 15, 23, 7, 8,
24, 2, 12, 9, 24, 24, 17, 24, 20, 7, 12, 12, 14, 18, 25, 20, 5, 18, 5, 20, 26, 12, 23, 18, 17, 17, 25, 15,
2, 24, 4, 2, 23, 25, 18, 25, 20, 14, 4, 2, 25, 7, 25, 17]);
const _F_MOD = (a, b) => ((a % b) + b) % b;
const _F_DELTA_D = (a, b) => dateDiff(b, a);
const _F_BEST_PIVOT = (date) => {
return dateCompare(date, _C_PANGALANTAKA_PAING) < 0 ? Pivot_1.Pivot.PIVOT_1971 : Pivot_1.Pivot.PIVOT_2000;
};
const _F_PAWUKON_DAY = (pivot, date) => {
return _F_MOD(pivot.pawukonDay + _F_DELTA_D(pivot.date, date), _C_DAY_PAWUKON);
};
const _F_CALC_CATURWARA = (pawukonDay) => {
if (pawukonDay < 71) {
return CaturWara_1.CaturWara.values[pawukonDay % 4];
}
else if (pawukonDay > 72) {
return CaturWara_1.CaturWara.values[(pawukonDay - 2) % 4];
}
else {
return CaturWara_1.CaturWara.JAYA;
}
};
const _F_CALC_ASTAWARA = (pawukonDay) => {
if (pawukonDay < 71) {
return AstaWara_1.AstaWara.values[pawukonDay % 8];
}
else if (pawukonDay > 72) {
return AstaWara_1.AstaWara.values[(pawukonDay - 2) % 8];
}
else {
return AstaWara_1.AstaWara.KALA;
}
};
const _F_CALC_SANGAWARA = (pawukonDay) => {
if (pawukonDay > 3) {
return SangaWara_1.SangaWara.values[(pawukonDay - 3) % 9];
}
else {
return SangaWara_1.SangaWara.DANGU;
}
};
const _F_CALC_SASIH_INFO = (pivot, date) => {
const res = new Array(3);
const ptime = pivot.date;
const dayDiff = _F_DELTA_D(ptime, date);
const daySkip = Math.ceil(dayDiff / _C_DAY_NGUNARATRI);
const dayTotal = pivot.sasihDay + dayDiff + daySkip;
const pivotOffset = (pivot.sasihDay === 0 && pivot.ngunaRatriDay === 0) ? 0 : 1;
let totalSasih = Math.ceil(dayTotal / 30) - pivotOffset;
let currentSasih = pivot.sasih.id;
let currentSaka = pivot.saka - (currentSasih === Sasih_1.Sasih.KADASA.id ? 1 : 0);
let nampihCount = pivot.isNampihSasih ? 1 : 0;
let inSK = false;
if (dateCompare(ptime, _C_SK_START) >= 0 && dateCompare(ptime, _C_SK_END) < 0) {
inSK = true;
}
while (totalSasih !== 0) {
if (dayDiff >= 0) {
if (nampihCount === 0 || nampihCount === 2) {
nampihCount = 0;
currentSasih = _F_MOD(currentSasih + 1, 12);
}
totalSasih = totalSasih - 1;
if (currentSasih === Sasih_1.Sasih.KADASA.id && nampihCount === 0) {
currentSaka = currentSaka + 1;
}
if (currentSasih === Sasih_1.Sasih.KAWOLU.id && currentSaka === 1914) {
inSK = true;
}
else if (currentSasih === Sasih_1.Sasih.KAWOLU.id && currentSaka === 1924) {
inSK = false;
}
}
else if (dayDiff < 0) {
if (nampihCount === 0 || nampihCount === 2) {
nampihCount = 0;
currentSasih = _F_MOD(currentSasih - 1, 12);
}
totalSasih = totalSasih + 1;
if (currentSasih === Sasih_1.Sasih.KASANGA.id && nampihCount === 0) {
currentSaka = currentSaka - 1;
}
if (currentSasih === Sasih_1.Sasih.KAPITU.id && currentSaka === 1914) {
inSK = false;
}
else if (currentSasih === Sasih_1.Sasih.KAPITU.id && currentSaka === 1924) {
inSK = true;
}
}
switch (currentSaka % 19) {
case 0:
case 6:
case 11:
if (currentSasih === Sasih_1.Sasih.DESTHA.id && !inSK) {
if (currentSaka !== 1925) {
nampihCount++;
}
}
break;
case 3:
case 8:
case 14:
case 16:
if (currentSasih === Sasih_1.Sasih.SADHA.id && !inSK) {
nampihCount++;
}
break;
case 2:
case 10:
if (currentSasih === Sasih_1.Sasih.DESTHA.id && inSK) {
nampihCount++;
}
break;
case 4:
if (currentSasih === Sasih_1.Sasih.KATIGA.id && inSK) {
nampihCount++;
}
break;
case 7:
if (currentSasih === Sasih_1.Sasih.KASA.id && inSK) {
nampihCount++;
}
break;
case 13:
if (currentSasih === Sasih_1.Sasih.KADASA.id && inSK) {
nampihCount++;
}
break;
case 15:
if (currentSasih === Sasih_1.Sasih.KARO.id && inSK) {
nampihCount++;
}
break;
case 18:
if (currentSasih === Sasih_1.Sasih.SADHA.id && inSK) {
nampihCount++;
}
break;
default:
break;
}
}
res[0] = currentSaka;
res[1] = currentSasih;
if (dayTotal >= 0) {
res[2] = nampihCount === 2 ? 1 : 0;
}
else {
res[2] = nampihCount === 1 ? 1 : 0;
}
return res;
};
const _F_CALC_SASIH_DAY = (pivot, date) => {
const res = new Array(3);
const ptime = pivot.date;
const dayDiff = _F_DELTA_D(ptime, date);
const daySkip = Math.ceil(dayDiff / _C_DAY_NGUNARATRI);
const dayTotal = pivot.sasihDay + dayDiff + daySkip;
res[0] = _F_MOD(dayTotal, 30);
res[1] = (res[0] === 0 || res[0] > 15) ? 1 : 0;
res[2] = (_F_MOD(dayDiff, _C_DAY_NGUNARATRI) === 0) ? 1 : 0;
res[0] = _F_MOD(res[0], 15);
res[0] = (res[0] === 0) ? 15 : res[0];
return res;
};
const _F_CALC_SASIH = (resSasih) => {
const saka = resSasih[0];
const sasih = resSasih[1];
let res = Sasih_1.Sasih.values[sasih];
if (resSasih[2] === 1) {
if (res === Sasih_1.Sasih.DESTHA) {
res = (saka < 1914) ? Sasih_1.Sasih.MALA_DESTHA : Sasih_1.Sasih.NAMPIH_DESTHA;
}
else if (res === Sasih_1.Sasih.KATIGA) {
res = Sasih_1.Sasih.NAMPIH_KATIGA;
}
else if (res === Sasih_1.Sasih.KASA) {
res = Sasih_1.Sasih.NAMPIH_KASA;
}
else if (res === Sasih_1.Sasih.KADASA) {
res = Sasih_1.Sasih.NAMPIH_KADASA;
}
else if (res === Sasih_1.Sasih.KARO) {
res = Sasih_1.Sasih.NAMPIH_KARO;
}
else if (res === Sasih_1.Sasih.SADHA) {
res = (saka < 1914) ? Sasih_1.Sasih.MALA_SADHA : Sasih_1.Sasih.NAMPIH_SADHA;
}
}
return res;
};
const _F_CALC_SASIH_DAY_INFO = (resSasihDay, sasih, saka) => {
const date = resSasihDay[0];
const isPangelong = resSasihDay[1] === 1;
const isNgunaRatri = resSasihDay[2] === 1;
if (isPangelong) {
if (date === 15 || (date === 14 && isNgunaRatri)) {
return SasihDayInfo_1.SasihDayInfo.TILEM;
}
else if (date === 14 && sasih === Sasih_1.Sasih.KAPITU && saka === 1921) {
return SasihDayInfo_1.SasihDayInfo.TILEM;
}
else {
return SasihDayInfo_1.SasihDayInfo.PANGELONG;
}
}
else {
if (date === 15 || (date === 14 && isNgunaRatri)) {
return SasihDayInfo_1.SasihDayInfo.PURNAMA;
}
else {
return SasihDayInfo_1.SasihDayInfo.PENANGGAL;
}
}
};
const _F_CALC_PRATITHI_S_P = (sasihDay, sasihDayInfo, sasih, date) => {
let move = 0;
const isNG = sasihDay.length > 1;
const day = isNG ? sasihDay[1] : sasihDay[0];
if (sasihDayInfo.reference === SasihDayInfo_1.SasihDayInfo.PENANGGAL) {
if (day === 1 && isNG) {
move = 0;
}
else {
if (day >= 1 && day <= 8) {
move = day - 1;
}
else if (day >= 9 && day <= 13) {
move = day - 2;
}
else if (day === 14) {
move = 11;
}
else if (day === 15) {
move = 0;
}
}
}
else {
if (day === 1 && isNG) {
const temp = dateAdd(date, 1);
const nextDay = new BalineseDate(temp);
if (nextDay.sasih.reference !== sasih.reference) {
move = -1;
}
}
else {
move = (day >= 13) ? day - 11 : day - 1;
}
}
const start = PratithiSamutPada_1.PratithiSamutPada.values[sasih.reference.id];
const newID = _F_MOD(start.id - move, 12);
return PratithiSamutPada_1.PratithiSamutPada.values[newID];
};
/***/ }),
/***/ "./src/BalineseDateUtil.ts":
/*!*********************************!*\
!*** ./src/BalineseDateUtil.ts ***!
\*********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const dateAdd = __webpack_require__(/*! date-fns/add_days */ "./node_modules/date-fns/add_days/index.js");
const dateDiff = __webpack_require__(/*! date-fns/difference_in_calendar_days */ "./node_modules/date-fns/difference_in_calendar_days/index.js");
const BalineseDate_1 = __webpack_require__(/*! ./BalineseDate */ "./src/BalineseDate.ts");
const PancaWara_1 = __webpack_require__(/*! ./PancaWara */ "./src/PancaWara.ts");
const Rahinan_1 = __webpack_require__(/*! ./Rahinan */ "./src/Rahinan.ts");
const SaptaWara_1 = __webpack_require__(/*! ./SaptaWara */ "./src/SaptaWara.ts");
const Sasih_1 = __webpack_require__(/*! ./Sasih */ "./src/Sasih.ts");
const SasihDayInfo_1 = __webpack_require__(/*! ./SasihDayInfo */ "./src/SasihDayInfo.ts");
const TriWara_1 = __webpack_require__(/*! ./TriWara */ "./src/TriWara.ts");
const Wuku_1 = __webpack_require__(/*! ./Wuku */ "./src/Wuku.ts");
class BalineseDateUtil {
static filterByDateRange(start, end, filter) {
const result = [];
let now = dateAdd(start, 0);
for (; dateDiff(end, now) >= 0; now = dateAdd(now, 1)) {
const x = new BalineseDate_1.BalineseDate(now);
if (this.filterByItem(x, filter)) {
result.push(x);
}
}
return result;
}
static filterByList(list, filter) {
const result = [];
for (const item of list) {
if (this.filterByItem(item, filter)) {
result.push(item);
}
}
return result;
}
static filterByItem(item, filter) {
if (filter !== undefined) {
if (!_F_CHECK(filter.wuku, item.wuku)) {
return false;
}
if (!_F_CHECK(filter.ekaWara, item.ekaWara)) {
return false;
}
if (!_F_CHECK(filter.dwiWara, item.dwiWara)) {
return false;
}
if (!_F_CHECK(filter.triWara, item.triWara)) {
return false;
}
if (!_F_CHECK(filter.caturWara, item.caturWara)) {
return false;
}
if (!_F_CHECK(filter.pancaWara, item.pancaWara)) {
return false;
}
if (!_F_CHECK(filter.sadWara, item.sadWara)) {
return false;
}
if (!_F_CHECK(filter.saptaWara, item.saptaWara)) {
return false;
}
if (!_F_CHECK(filter.astaWara, item.astaWara)) {
return false;
}
if (!_F_CHECK(filter.sangaWara, item.sangaWara)) {
return false;
}
if (!_F_CHECK(filter.dasaWara, item.dasaWara)) {
return false;
}
if (!_F_CHECK(filter.ingkel, item.ingkel)) {
return false;
}
if (!_F_CHECK(filter.jejepan, item.jejepan)) {
return false;
}
if (!_F_CHECK(filter.watekAlit, item.watekAlit)) {
return false;
}
if (!_F_CHECK(filter.watekMadya, item.watekMadya)) {
return false;
}
if (!_F_CHECK(filter.lintang, item.lintang)) {
return false;
}
if (!_F_CHECK(filter.pancaSuda, item.pancaSuda)) {
return false;
}
if (!_F_CHECK(filter.pararasan, item.pararasan)) {
return false;
}
if (!_F_CHECK(filter.rakam, item.rakam)) {
return false;
}
if (!_F_CHECK(filter.ekaJalaRsi, item.ekaJalaRsi)) {
return false;
}
if (!_F_CHECK(filter.saka, item.saka)) {
return false;
}
if (!_F_CHECK(filter.sasih, item.sasih)) {
return false;
}
if (!_F_CHECK(filter.pratithiSamutPada, item.pratithiSamutPada)) {
return false;
}
if (!_F_CHECK_SASIH_D(filter.sasihDay, item.sasihDay)) {
return false;
}
if (!_F_CHECK_SASIH_D_I(filter.sasihDayInfo, item.sasihDayInfo)) {
return false;
}
}
return true;
}
static getRahinan(date) {
return _F_CALC_RAHINAN(date);
}
}
exports.BalineseDateUtil = BalineseDateUtil;
const _F_ARRAY_CHECK = (a, b) => {
if (a.length === b.length) {
for (let i = 0; i < a.length; i++) {
if (a[i] !== b[i]) {
return false;
}
}
return true;
}
return false;
};
const _F_CHECK = (expectation, reality) => {
return (expectation !== undefined) ? (expectation === reality) : true;
};
const _F_CHECK_SASIH_D = (expectation, reality) => {
if (expectation !== undefined) {
switch (expectation.length) {
case 1:
if (reality.length === 1) {
return (expectation[0] === reality[0]);
}
else if (reality.length === 2) {
return (expectation[0] === reality[0]) || (expectation[0] === reality[1]);
}
return false;
case 2:
return (reality.length === 2) ? _F_ARRAY_CHECK(expectation, reality) : false;
default:
return false;
}
}
return true;
};
const _F_CHECK_SASIH_D_I = (expectation, reality) => {
if (expectation !== undefined) {
if (expectation === SasihDayInfo_1.SasihDayInfo.PURNAMA || expectation === SasihDayInfo_1.SasihDayInfo.TILEM) {
return expectation === reality;
}
else {
return expectation === reality.reference;
}
}
return true;
};
const _F_CALC_RAHINAN = (date) => {
const arr = new Array();
if (date !== undefined) {
if (date.triWara === TriWara_1.TriWara.KAJENG && date.pancaWara === PancaWara_1.PancaWara.KLIWON) {
arr.push(Rahinan_1.Rahinan.KAJENG_KLIWON);
}
if (date.saptaWara === SaptaWara_1.SaptaWara.ANGGARA && date.pancaWara === PancaWara_1.PancaWara.KLIWON) {
arr.push(Rahinan_1.Rahinan.ANGGARA_KASIH);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.BUDA && date.pancaWara === PancaWara_1.PancaWara.WAGE) {
arr.push(Rahinan_1.Rahinan.BUDA_CEMENG);
}
if (date.wuku === Wuku_1.Wuku.SINTA) {
if (date.saptaWara === SaptaWara_1.SaptaWara.REDITE) {
arr.push(Rahinan_1.Rahinan.BANYU_PINARUH);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.SOMA) {
arr.push(Rahinan_1.Rahinan.SOMA_RIBEK);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.ANGGARA) {
arr.push(Rahinan_1.Rahinan.SABUH_EMAS);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.BUDA) {
arr.push(Rahinan_1.Rahinan.PAGER_WESI);
}
}
else if (date.wuku === Wuku_1.Wuku.LANDEP) {
if (date.saptaWara === SaptaWara_1.SaptaWara.SANISCARA) {
arr.push(Rahinan_1.Rahinan.TUMPEK_LANDEP);
}
}
else if (date.wuku === Wuku_1.Wuku.WARIGA) {
if (date.saptaWara === SaptaWara_1.SaptaWara.SANISCARA) {
arr.push(Rahinan_1.Rahinan.TUMPEK_UDUH);
}
}
else if (date.wuku === Wuku_1.Wuku.SUNGSANG) {
if (date.saptaWara === SaptaWara_1.SaptaWara.WRASPATI) {
arr.push(Rahinan_1.Rahinan.SUGIHAN_JAWA);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.SUKRA) {
arr.push(Rahinan_1.Rahinan.SUGIHAN_BALI);
}
}
else if (date.wuku === Wuku_1.Wuku.DUNGULAN) {
if (date.saptaWara === SaptaWara_1.SaptaWara.REDITE) {
arr.push(Rahinan_1.Rahinan.PENYEKEBAN_GALUNGAN);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.SOMA) {
arr.push(Rahinan_1.Rahinan.PENYAJAN_GALUNGAN);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.ANGGARA) {
arr.push(Rahinan_1.Rahinan.PENAMPAHAN_GALUNGAN);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.BUDA) {
arr.push(Rahinan_1.Rahinan.GALUNGAN);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.WRASPATI) {
arr.push(Rahinan_1.Rahinan.MANIS_GALUNGAN);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.SANISCARA) {
arr.push(Rahinan_1.Rahinan.PEMARIDAN_GURU);
}
}
else if (date.wuku === Wuku_1.Wuku.KUNINGAN) {
if (date.saptaWara === SaptaWara_1.SaptaWara.REDITE) {
arr.push(Rahinan_1.Rahinan.ULIHAN);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.SOMA) {
arr.push(Rahinan_1.Rahinan.PEMACEKAN_AGUNG);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.SUKRA) {
arr.push(Rahinan_1.Rahinan.PENAMPAHAN_KUNINGAN);
}
else if (date.saptaWara === SaptaWara_1.SaptaWara.SANISCARA) {
arr.push(Rahinan_1.Rahinan.KUNINGAN);
}
}
else if (date.wuku === Wuku_1.Wuku.PAHANG) {
if (date.saptaWara === SaptaWara_1.SaptaWara.BUDA) {
arr.push(Rahinan_1.Rahinan.PEGAT_UWAKAN);
}
}
else if (date.wuku === Wuku_1.Wuku.UYE) {
if (date.saptaWara === SaptaWara_1.SaptaWara.SANISCARA) {
arr.push(Rahinan_1.Rahinan.TUMPEK_KANDANG);
}
}
else if (date.wuku === Wuku_1.Wuku.WAYANG) {
if (date.saptaWara === SaptaWara_1.SaptaWara.SANISCARA) {
arr.push(Rahinan_1.Rahinan.TUMPEK_WAYANG);
}
}
else if (date.wuku === Wuku_1.Wuku.WATUGUNUNG) {
if (date.saptaWara === SaptaWara_1.SaptaWara.SANISCARA) {
arr.push(Rahinan_1.Rahinan.SARASWATI);
}
}
const temp = date.date;
const n1Day = new BalineseDate_1.BalineseDate(dateAdd(temp, 1));
const b1Day = new BalineseDate_1.BalineseDate(dateAdd(temp, -1));
const b2Day = new BalineseDate_1.BalineseDate(dateAdd(temp, -2));
if (n1Day.sasih === Sasih_1.Sasih.KAPITU && n1Day.sasihDayInfo === SasihDayInfo_1.SasihDayInfo.TILEM) {
arr.push(Rahinan_1.Rahinan.SIWA_RATRI);
}
else if (date.saka < n1Day.saka) {
arr.push(Rahinan_1.Rahinan.TAWUR_AGUNG_KASANGA);
}
else if (b1Day.saka < date.saka) {
arr.push(Rahinan_1.Rahinan.NYEPI);
}
else if (b2Day.saka < date.saka && b1Day.saka === date.saka) {
arr.push(Rahinan_1.Rahinan.NGEMBAK_GENI);
}
if (date.sasihDayInfo === SasihDayInfo_1.SasihDayInfo.PURNAMA) {
arr.push(Rahinan_1.Rahinan.PURNAMA);
}
else if (date.sasihDayInfo === SasihDayInfo_1.SasihDayInfo.TILEM) {
arr.push(Rahinan_1.Rahinan.TILEM);
}
}
Object.fr